OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/udp/udp_socket_libevent.h" | 5 #include "net/udp/udp_socket_libevent.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <netdb.h> | 9 #include <netdb.h> |
10 #include <net/if.h> | 10 #include <net/if.h> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 write_buf_ = NULL; | 120 write_buf_ = NULL; |
121 write_buf_len_ = 0; | 121 write_buf_len_ = 0; |
122 write_callback_.Reset(); | 122 write_callback_.Reset(); |
123 send_to_address_.reset(); | 123 send_to_address_.reset(); |
124 | 124 |
125 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); | 125 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); |
126 DCHECK(ok); | 126 DCHECK(ok); |
127 ok = write_socket_watcher_.StopWatchingFileDescriptor(); | 127 ok = write_socket_watcher_.StopWatchingFileDescriptor(); |
128 DCHECK(ok); | 128 DCHECK(ok); |
129 | 129 |
130 if (IGNORE_EINTR(close(socket_)) < 0) | 130 if (IGNORE_EINTR(close(socket_)) < 0) { |
131 PLOG(ERROR) << "close"; | 131 PLOG(ERROR) << "close"; |
132 | 132 |
133 // Crash if errno=EBADF, to debug crbug.com/452121 . | |
mef
2015/02/11 19:25:35
Could you add TODO(sergeyu) to remove it once inve
| |
134 CHECK_NE(EBADF, errno); | |
135 } | |
136 | |
133 socket_ = kInvalidSocket; | 137 socket_ = kInvalidSocket; |
134 addr_family_ = 0; | 138 addr_family_ = 0; |
135 is_connected_ = false; | 139 is_connected_ = false; |
136 } | 140 } |
137 | 141 |
138 int UDPSocketLibevent::GetPeerAddress(IPEndPoint* address) const { | 142 int UDPSocketLibevent::GetPeerAddress(IPEndPoint* address) const { |
139 DCHECK(CalledOnValidThread()); | 143 DCHECK(CalledOnValidThread()); |
140 DCHECK(address); | 144 DCHECK(address); |
141 if (!is_connected()) | 145 if (!is_connected()) |
142 return ERR_SOCKET_NOT_CONNECTED; | 146 return ERR_SOCKET_NOT_CONNECTED; |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 return MapSystemError(errno); | 753 return MapSystemError(errno); |
750 | 754 |
751 return OK; | 755 return OK; |
752 } | 756 } |
753 | 757 |
754 void UDPSocketLibevent::DetachFromThread() { | 758 void UDPSocketLibevent::DetachFromThread() { |
755 base::NonThreadSafe::DetachFromThread(); | 759 base::NonThreadSafe::DetachFromThread(); |
756 } | 760 } |
757 | 761 |
758 } // namespace net | 762 } // namespace net |
OLD | NEW |