From: Guus Sliepen Date: Sun, 17 Jul 2011 17:34:01 +0000 (+0200) Subject: Flush output buffer in send_tcppacket(). X-Git-Tag: release-1.0.16~2 X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=50fcfea127c9d2fdf8894498a9fdcc6fb3bbb2ce Flush output buffer in send_tcppacket(). This is mainly important for Windows, where the select() call in the main thread is not being woken up when the tapreader thread calls route(), causing a delay of up to 1 second before the output buffer is flushed. This would cause bad performance when UDP communication is not possible. --- diff --git a/src/protocol_misc.c b/src/protocol_misc.c index 6f7ab03b..3d405bc4 100644 --- a/src/protocol_misc.c +++ b/src/protocol_misc.c @@ -129,7 +129,7 @@ bool send_tcppacket(connection_t *c, const vpn_packet_t *packet) { if(!send_request(c, "%d %hd", PACKET, packet->len)) return false; - return send_meta(c, (char *)packet->data, packet->len); + return send_meta(c, (char *)packet->data, packet->len) && flush_meta(c); } bool tcppacket_h(connection_t *c) {