Skip to content

Commit

Permalink
Don't double resubscribe to asio events in TCPConnection (#1509)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
SeanTAllen authored and sylvanc committed Jan 18, 2017
1 parent 8daa6ef commit 195dc59
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/net/tcp_connection.pony
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ actor TCPConnection
Resume reading.
"""
_pending_reads()
_resubscribe_event()

fun ref write_final(data: ByteSeq) =>
"""
Expand Down Expand Up @@ -617,7 +618,6 @@ actor TCPConnection
| 0 =>
// Would block, try again later.
_readable = false
_resubscribe_event()
return
| _next_size =>
// Increase the read buffer size.
Expand Down Expand Up @@ -754,7 +754,6 @@ actor TCPConnection
fun ref _apply_backpressure() =>
ifdef not windows then
_writeable = false
_resubscribe_event()
end

_notify.throttled(this)
Expand Down

0 comments on commit 195dc59

Please sign in to comment.