diff options
Diffstat (limited to 'net/udp/udp_socket_libevent.cc')
-rw-r--r-- | net/udp/udp_socket_libevent.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc index de24253..15a149b96 100644 --- a/net/udp/udp_socket_libevent.cc +++ b/net/udp/udp_socket_libevent.cc @@ -103,14 +103,19 @@ UDPSocketLibevent::~UDPSocketLibevent() { void UDPSocketLibevent::Close() { DCHECK(CalledOnValidThread()); - if (read_callback_) - DoReadCallback(ERR_ABORTED); - if (write_callback_) - DoReadCallback(ERR_ABORTED); - if (!is_connected()) return; + // Zero out any pending read/write callback state. + read_buf_ = NULL; + read_buf_len_ = 0; + read_callback_ = NULL; + recv_from_address_ = NULL; + write_buf_ = NULL; + write_buf_len_ = 0; + write_callback_ = NULL; + send_to_address_.reset(); + bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); DCHECK(ok); ok = write_socket_watcher_.StopWatchingFileDescriptor(); |