| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/network_change_notifier_linux.h" | 5 #include "net/base/network_change_notifier_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <sys/socket.h> | 8 #include <sys/socket.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/eintr_wrapper.h" | 11 #include "base/eintr_wrapper.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 MessageLoopForIO::WATCH_READ, &netlink_watcher_, this); | 125 MessageLoopForIO::WATCH_READ, &netlink_watcher_, this); |
| 126 LOG_IF(ERROR, !rv) << "Failed to watch netlink socket: " << netlink_fd_; | 126 LOG_IF(ERROR, !rv) << "Failed to watch netlink socket: " << netlink_fd_; |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 int NetworkChangeNotifierLinux::Thread::ReadNotificationMessage( | 130 int NetworkChangeNotifierLinux::Thread::ReadNotificationMessage( |
| 131 char* buf, | 131 char* buf, |
| 132 size_t len) { | 132 size_t len) { |
| 133 DCHECK_NE(len, 0u); | 133 DCHECK_NE(len, 0u); |
| 134 DCHECK(buf); | 134 DCHECK(buf); |
| 135 memset(buf, 0, sizeof(buf)); | 135 memset(buf, 0, len); |
| 136 int rv = recv(netlink_fd_, buf, len, 0); | 136 int rv = recv(netlink_fd_, buf, len, 0); |
| 137 if (rv > 0) | 137 if (rv > 0) |
| 138 return rv; | 138 return rv; |
| 139 | 139 |
| 140 DCHECK_NE(rv, 0); | 140 DCHECK_NE(rv, 0); |
| 141 if (errno != EAGAIN && errno != EWOULDBLOCK) { | 141 if (errno != EAGAIN && errno != EWOULDBLOCK) { |
| 142 PLOG(DFATAL) << "recv"; | 142 PLOG(DFATAL) << "recv"; |
| 143 return ERR_FAILED; | 143 return ERR_FAILED; |
| 144 } | 144 } |
| 145 | 145 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 160 // check that the notifier thread shut down properly. | 160 // check that the notifier thread shut down properly. |
| 161 notifier_thread_->Stop(); | 161 notifier_thread_->Stop(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 bool NetworkChangeNotifierLinux::IsCurrentlyOffline() const { | 164 bool NetworkChangeNotifierLinux::IsCurrentlyOffline() const { |
| 165 // TODO(eroman): http://crbug.com/53473 | 165 // TODO(eroman): http://crbug.com/53473 |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace net | 169 } // namespace net |
| OLD | NEW |