info: do not block when sending data
authorHenning Rogge <hrogge@gmail.com>
Wed, 6 Dec 2017 16:44:17 +0000 (17:44 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 6 Dec 2017 16:44:38 +0000 (17:44 +0100)
Even though checks are done that we can actually send, the send
can still block.

Reported-By: Joe Ayers <joe@ayerscasa.com>
Signed-off-by: Henning Rogge <hrogge@gmail.com>
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
lib/info/olsrd_info.c

index 702bddf..77100d0 100644 (file)
@@ -324,7 +324,7 @@ static void send_status_no_retries(const char * req, bool add_headers, int the_s
     }
   }
 
-  (void) send(the_socket, abuf.buf, abuf.len, 0);
+  (void) send(the_socket, abuf.buf, abuf.len, MSG_DONTWAIT);
   close(the_socket);
   abuf_free(&abuf);
 }
@@ -368,7 +368,7 @@ static void write_data(void *unused __attribute__((unused))) {
       continue;
     }
 
-    result = send(outbuffer.socket[i], outbuffer.buffer[i] + outbuffer.written[i], outbuffer.size[i] - outbuffer.written[i], 0);
+    result = send(outbuffer.socket[i], outbuffer.buffer[i] + outbuffer.written[i], outbuffer.size[i] - outbuffer.written[i], MSG_DONTWAIT);
     if (result > 0) {
       outbuffer.written[i] += result;
     }