diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-07 18:27:17 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-07 18:27:17 +0200 |
commit | 0617f29955a1c7ce712c875d6216de8544ec7249 (patch) | |
tree | 9e7ea8a2aa2e04f92cafe7db5ea0e1f2c4c87f8b | |
parent | sort interceptors by priority (diff) | |
download | mds-0617f29955a1c7ce712c875d6216de8544ec7249.tar.gz mds-0617f29955a1c7ce712c875d6216de8544ec7249.tar.bz2 mds-0617f29955a1c7ce712c875d6216de8544ec7249.tar.xz |
send to clients (does not implement modifiers yet)
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/mds-server.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/mds-server.c b/src/mds-server.c index 8f0e8fe..7bd79df 100644 --- a/src/mds-server.c +++ b/src/mds-server.c @@ -1045,7 +1045,35 @@ void multicast_message(char* message, size_t length) /* Sort interceptors. */ qsort(interceptions, interceptions_count, sizeof(queued_interception_t), cmp_queued_interception); - /* TODO */ + /* Send message to interceptors. */ + for (i = 0; i < interceptions_count; i++) + { + queued_interception_t client_ = interceptions[i]; + client_t* client = client_.client; + char* msg = message; + size_t sent; + n = length; + + with_mutex(client->mutex, + while (n > 0) + { + sent = send_message(client->socket_fd, msg, n); + if ((sent < n) && (errno != EINTR)) /* Ignore EINTR */ + { + perror(*argv); + break; + } + n -= sent; + msg += sent; + } + ); + + if ((n > 0) && client_.modifying) + { + /* TODO */ + } + } + errno = 0; fail: /* This is done before this function returns even if there was no error. */ |