From 195dc590d745aab7b44669f856ff47e34ed3a4d0 Mon Sep 17 00:00:00 2001 From: Sean T Allen Date: Wed, 18 Jan 2017 15:37:05 -0500 Subject: [PATCH] Don't double resubscribe to asio events in TCPConnection (#1509) The previous one shot code for resubscribing was incorrect. It could end up subscribing to an event more than once. From what I've read for epoll, its undefined behavior if you do that. --- packages/net/tcp_connection.pony | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/net/tcp_connection.pony b/packages/net/tcp_connection.pony index 2b3bb6653d..7c59017ea3 100644 --- a/packages/net/tcp_connection.pony +++ b/packages/net/tcp_connection.pony @@ -417,6 +417,7 @@ actor TCPConnection Resume reading. """ _pending_reads() + _resubscribe_event() fun ref write_final(data: ByteSeq) => """ @@ -617,7 +618,6 @@ actor TCPConnection | 0 => // Would block, try again later. _readable = false - _resubscribe_event() return | _next_size => // Increase the read buffer size. @@ -754,7 +754,6 @@ actor TCPConnection fun ref _apply_backpressure() => ifdef not windows then _writeable = false - _resubscribe_event() end _notify.throttled(this)