Fix socket not getting registered for epoll events
When epoll is enabled in the PhysicalSocketServer, a socket may not get registered for its epoll events. If an AsyncSocket is closed and re-created during one of its signal callbacks, its old epoll events and new epolls events bitmasks may be the same, even though the fd has changed. This causes the epoll implementation to not register the new fd for any events. Fix this by resetting the saved events bitmask when the socket is closed. This ensures the new fd, if any, is registered if needed. Bug: webrtc:11497 Change-Id: Idea499e09aefdf292430d1a774a046f963603b95 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173103 Reviewed-by: Taylor <deadbeef@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31039}
This commit is contained in:
parent
46d2d5e4c4
commit
25eeda1872
@ -893,6 +893,14 @@ int SocketDispatcher::Close() {
|
||||
#if defined(WEBRTC_WIN)
|
||||
id_ = 0;
|
||||
signal_close_ = false;
|
||||
#endif
|
||||
#if defined(WEBRTC_USE_EPOLL)
|
||||
// If we're batching events, the socket can be closed and reopened
|
||||
// during the batch. Set saved_enabled_events_ to 0 here so the new
|
||||
// socket, if any, has the correct old events bitfield
|
||||
if (saved_enabled_events_ != -1) {
|
||||
saved_enabled_events_ = 0;
|
||||
}
|
||||
#endif
|
||||
ss_->Remove(this);
|
||||
return PhysicalSocket::Close();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user