| OLD | NEW |
| 1 // Copyright (c) 2011 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/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> |
| 11 | 11 |
| 12 #include "base/eintr_wrapper.h" | 12 #include "base/eintr_wrapper.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/metrics/stats_counters.h" | 15 #include "base/metrics/stats_counters.h" |
| 16 #include "net/base/io_buffer.h" | 16 #include "net/base/io_buffer.h" |
| 17 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 19 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
| 20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| 21 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
| 22 #include <netinet/in.h> | 22 #include <netinet/in.h> |
| 23 #endif | 23 #endif |
| 24 #if defined(USE_SYSTEM_LIBEVENT) | |
| 25 #include <event.h> | |
| 26 #else | |
| 27 #include "third_party/libevent/event.h" | |
| 28 #endif | |
| 29 | 24 |
| 30 namespace net { | 25 namespace net { |
| 31 | 26 |
| 32 UDPSocketLibevent::UDPSocketLibevent(net::NetLog* net_log, | 27 UDPSocketLibevent::UDPSocketLibevent(net::NetLog* net_log, |
| 33 const net::NetLog::Source& source) | 28 const net::NetLog::Source& source) |
| 34 : socket_(kInvalidSocket), | 29 : socket_(kInvalidSocket), |
| 35 read_watcher_(this), | 30 read_watcher_(this), |
| 36 write_watcher_(this), | 31 write_watcher_(this), |
| 37 read_buf_len_(0), | 32 read_buf_len_(0), |
| 38 recv_from_address_(NULL), | 33 recv_from_address_(NULL), |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 353 |
| 359 return HANDLE_EINTR(sendto(socket_, | 354 return HANDLE_EINTR(sendto(socket_, |
| 360 buf->data(), | 355 buf->data(), |
| 361 buf_len, | 356 buf_len, |
| 362 0, | 357 0, |
| 363 addr, | 358 addr, |
| 364 addr_len)); | 359 addr_len)); |
| 365 } | 360 } |
| 366 | 361 |
| 367 } // namespace net | 362 } // namespace net |
| OLD | NEW |