Skip to content

Commit 9f515fe

Browse files
authored
Fix a potential race condition (#185)
1 parent d386240 commit 9f515fe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

trantor/net/inner/Connector.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ int Connector::removeAndResetChannel()
147147
channelPtr_->remove();
148148
int sockfd = channelPtr_->fd();
149149
// Can't reset channel_ here, because we are inside Channel::handleEvent
150-
loop_->queueInLoop([this]() { channelPtr_.reset(); });
150+
loop_->queueInLoop([channelPtr = channelPtr_]() {});
151+
channelPtr_.reset();
151152
return sockfd;
152153
}
153154

0 commit comments

Comments
 (0)