Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1687)

Unified Diff: net/udp/udp_socket_win.cc

Issue 10882020: [net/udp] Close events and invalidate handles when UDPSocketWin is closed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add check that the socket is still open Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/udp/udp_socket_win.cc
diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc
index 03c724ee930760b5026bf8fbe6ce0a9ae4d9ef21..f67c010a8595f84832bb0dec163a53118201d377 100644
--- a/net/udp/udp_socket_win.cc
+++ b/net/udp/udp_socket_win.cc
@@ -83,6 +83,11 @@ void UDPSocketWin::Close() {
read_watcher_.StopWatching();
write_watcher_.StopWatching();
+ WSACloseEvent(read_overlapped_.hEvent);
+ memset(&read_overlapped_, 0xaf, sizeof(read_overlapped_));
+ WSACloseEvent(write_overlapped_.hEvent);
+ memset(&write_overlapped_, 0xaf, sizeof(write_overlapped_));
+
closesocket(socket_);
socket_ = INVALID_SOCKET;
}
@@ -379,6 +384,7 @@ int UDPSocketWin::InternalRecvFrom(IOBuffer* buf, int buf_len,
DWORD flags = 0;
DWORD num;
+ CHECK_NE(INVALID_SOCKET, socket_);
AssertEventNotSignaled(read_overlapped_.hEvent);
int rv = WSARecvFrom(socket_, &read_buffer, 1, &num, &flags, addr,
&recv_addr_len_, &read_overlapped_, NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698