From 0fb2236580debdd37eeac27a5e0ae81d160400b4 Mon Sep 17 00:00:00 2001 From: Jeffrey Hutzelman Date: Sat, 23 Feb 2013 03:34:06 -0500 Subject: server: add CLIENT_FLUSHSUBS control message This adds support to the server for a new client control message, CLIENT_FLUSHSUBS, which flushes all subscriptions and pending retransmits for clients belonging to a given principal. The target principal must be the same as the sender, unless the sender is on the opstaff ACL. This is the server side of #103 --- server/client.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'server/client.c') diff --git a/server/client.c b/server/client.c index 56c5190..02e9862 100644 --- a/server/client.c +++ b/server/client.c @@ -146,6 +146,24 @@ client_flush_host(struct in_addr *host) uloc_hflush(host); } +/* Unlike client_flush_host, this flushes only subs, not locations */ +void +client_flush_princ(char *target) +{ + int i; + Client *client, *next; + String *principal = make_string(target, 0); + + for (i = 0; i < HASHSIZE; i++) { + for (client = client_bucket[i]; client; client = next) { + next = client->next; + if (client->principal == principal) + client_deregister(client, 0); + } + } + free_string(principal); +} + Code_t client_send_clients(void) { -- cgit v1.2.3