| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/socket/tcp_client_socket_libevent.h" | 5 #include "net/socket/tcp_client_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> |
| 11 | 11 |
| 12 #include "base/eintr_wrapper.h" | 12 #include "base/eintr_wrapper.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/trace_event.h" | 15 #include "base/trace_event.h" |
| 16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 17 #include "net/base/load_log.h" | 17 #include "net/base/load_log.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #if defined(USE_SYSTEM_LIBEVENT) |
| 20 #include <event.h> |
| 21 #else |
| 19 #include "third_party/libevent/event.h" | 22 #include "third_party/libevent/event.h" |
| 20 | 23 #endif |
| 21 | 24 |
| 22 namespace net { | 25 namespace net { |
| 23 | 26 |
| 24 namespace { | 27 namespace { |
| 25 | 28 |
| 26 const int kInvalidSocket = -1; | 29 const int kInvalidSocket = -1; |
| 27 | 30 |
| 28 // Return 0 on success, -1 on failure. | 31 // Return 0 on success, -1 on failure. |
| 29 // Too small a function to bother putting in a library? | 32 // Too small a function to bother putting in a library? |
| 30 int SetNonBlocking(int fd) { | 33 int SetNonBlocking(int fd) { |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 DoWriteCallback(result); | 449 DoWriteCallback(result); |
| 447 } | 450 } |
| 448 } | 451 } |
| 449 | 452 |
| 450 int TCPClientSocketLibevent::GetPeerName(struct sockaddr* name, | 453 int TCPClientSocketLibevent::GetPeerName(struct sockaddr* name, |
| 451 socklen_t* namelen) { | 454 socklen_t* namelen) { |
| 452 return ::getpeername(socket_, name, namelen); | 455 return ::getpeername(socket_, name, namelen); |
| 453 } | 456 } |
| 454 | 457 |
| 455 } // namespace net | 458 } // namespace net |
| OLD | NEW |