| 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 <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 write_buf_ = NULL; | 76 write_buf_ = NULL; |
| 77 write_buf_len_ = 0; | 77 write_buf_len_ = 0; |
| 78 write_callback_.Reset(); | 78 write_callback_.Reset(); |
| 79 send_to_address_.reset(); | 79 send_to_address_.reset(); |
| 80 | 80 |
| 81 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); | 81 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); |
| 82 DCHECK(ok); | 82 DCHECK(ok); |
| 83 ok = write_socket_watcher_.StopWatchingFileDescriptor(); | 83 ok = write_socket_watcher_.StopWatchingFileDescriptor(); |
| 84 DCHECK(ok); | 84 DCHECK(ok); |
| 85 | 85 |
| 86 if (HANDLE_EINTR(close(socket_)) < 0) | 86 if (IGNORE_EINTR(close(socket_)) < 0) |
| 87 PLOG(ERROR) << "close"; | 87 PLOG(ERROR) << "close"; |
| 88 | 88 |
| 89 socket_ = kInvalidSocket; | 89 socket_ = kInvalidSocket; |
| 90 addr_family_ = 0; | 90 addr_family_ = 0; |
| 91 } | 91 } |
| 92 | 92 |
| 93 int UDPSocketLibevent::GetPeerAddress(IPEndPoint* address) const { | 93 int UDPSocketLibevent::GetPeerAddress(IPEndPoint* address) const { |
| 94 DCHECK(CalledOnValidThread()); | 94 DCHECK(CalledOnValidThread()); |
| 95 DCHECK(address); | 95 DCHECK(address); |
| 96 if (!is_connected()) | 96 if (!is_connected()) |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 rv = setsockopt(socket_, IPPROTO_IPV6, IPV6_TCLASS, | 666 rv = setsockopt(socket_, IPPROTO_IPV6, IPV6_TCLASS, |
| 667 &dscp_and_ecn, sizeof(dscp_and_ecn)); | 667 &dscp_and_ecn, sizeof(dscp_and_ecn)); |
| 668 } | 668 } |
| 669 if (rv < 0) | 669 if (rv < 0) |
| 670 return MapSystemError(errno); | 670 return MapSystemError(errno); |
| 671 | 671 |
| 672 return OK; | 672 return OK; |
| 673 } | 673 } |
| 674 | 674 |
| 675 } // namespace net | 675 } // namespace net |
| OLD | NEW |