 Chromium Code Reviews
 Chromium Code Reviews Issue 1025533002:
  PCHECK when closing UDP sockets only when errno=EBADF.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1025533002:
  PCHECK when closing UDP sockets only when errno=EBADF.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 write_buf_ = NULL; | 119 write_buf_ = NULL; | 
| 120 write_buf_len_ = 0; | 120 write_buf_len_ = 0; | 
| 121 write_callback_.Reset(); | 121 write_callback_.Reset(); | 
| 122 send_to_address_.reset(); | 122 send_to_address_.reset(); | 
| 123 | 123 | 
| 124 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); | 124 bool ok = read_socket_watcher_.StopWatchingFileDescriptor(); | 
| 125 DCHECK(ok); | 125 DCHECK(ok); | 
| 126 ok = write_socket_watcher_.StopWatchingFileDescriptor(); | 126 ok = write_socket_watcher_.StopWatchingFileDescriptor(); | 
| 127 DCHECK(ok); | 127 DCHECK(ok); | 
| 128 | 128 | 
| 129 PCHECK(0 == IGNORE_EINTR(close(socket_))); | 129 if (IGNORE_EINTR(close(socket_)) == -1) | 
| 130 PCHECK(errno != EBADF); | |
| 
rvargas (doing something else)
2015/03/19 22:34:05
How about filtering by EIO instead and leaving err
 
Sergey Ulanov
2015/03/19 22:53:35
Done.
 | |
| 130 | 131 | 
| 131 socket_ = kInvalidSocket; | 132 socket_ = kInvalidSocket; | 
| 132 addr_family_ = 0; | 133 addr_family_ = 0; | 
| 133 is_connected_ = false; | 134 is_connected_ = false; | 
| 134 } | 135 } | 
| 135 | 136 | 
| 136 int UDPSocketLibevent::GetPeerAddress(IPEndPoint* address) const { | 137 int UDPSocketLibevent::GetPeerAddress(IPEndPoint* address) const { | 
| 137 DCHECK(CalledOnValidThread()); | 138 DCHECK(CalledOnValidThread()); | 
| 138 DCHECK(address); | 139 DCHECK(address); | 
| 139 if (!is_connected()) | 140 if (!is_connected()) | 
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 return MapSystemError(errno); | 744 return MapSystemError(errno); | 
| 744 | 745 | 
| 745 return OK; | 746 return OK; | 
| 746 } | 747 } | 
| 747 | 748 | 
| 748 void UDPSocketLibevent::DetachFromThread() { | 749 void UDPSocketLibevent::DetachFromThread() { | 
| 749 base::NonThreadSafe::DetachFromThread(); | 750 base::NonThreadSafe::DetachFromThread(); | 
| 750 } | 751 } | 
| 751 | 752 | 
| 752 } // namespace net | 753 } // namespace net | 
| OLD | NEW |