+bool flush_meta(connection_t *c) {
+ int result;
+
+ ifdebug(META) logger(LOG_DEBUG, "Flushing %d bytes to %s (%s)",
+ c->outbuflen, c->name, c->hostname);
+
+ while(c->outbuflen) {
+ result = send(c->socket, c->outbuf + c->outbufstart, c->outbuflen, 0);
+ if(result <= 0) {
+ if(!errno || errno == EPIPE) {
+ ifdebug(CONNECTIONS) logger(LOG_NOTICE, "Connection closed by %s (%s)",
+ c->name, c->hostname);
+ } else if(errno == EINTR) {
+ continue;
+ } else if(sockwouldblock(sockerrno)) {
+ ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Flushing %d bytes to %s (%s) would block",
+ c->outbuflen, c->name, c->hostname);
+ return true;
+ } else {
+ logger(LOG_ERR, "Flushing meta data to %s (%s) failed: %s", c->name,
+ c->hostname, sockstrerror(sockerrno));
+ }
+
+ return false;
+ }
+
+ c->outbufstart += result;
+ c->outbuflen -= result;
+ }
+
+ c->outbufstart = 0; /* avoid unnecessary memmoves */
+ return true;
+}
+
+void broadcast_meta(connection_t *from, const char *buffer, int length) {