Skip to content

Commit e84df1d

Browse files
committed
Properly handle ECONNABORTED from accept().
1 parent f229bf2 commit e84df1d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/net/listen.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ Listen::event_read() {
122122
if (errno == EAGAIN || errno == EWOULDBLOCK)
123123
break;
124124

125+
// Force a new event_read() call just to be sure we don't enter an infinite loop.
126+
if (errno == ECONNABORTED)
127+
break;
128+
125129
throw resource_error("Listener port accept() failed: " + std::string(std::strerror(errno)));
126130
}
127131

src/tracker/tracker_http.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ TrackerHttp::send_event(tracker::TrackerState::event_enum new_state) {
9898
m_data = std::make_unique<std::stringstream>();
9999
m_get.reset(request_url, m_data);
100100

101+
// TODO: Should bind address here...
102+
101103
if (is_block_ipv4 && is_block_ipv6) {
102104
throw torrent::internal_error("Cannot send tracker event, both IPv4 and IPv6 are blocked.");
103105
} else if (is_block_ipv4) {

0 commit comments

Comments
 (0)