OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_socket_libevent.h" | 5 #include "net/socket/tcp_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 23 matching lines...) Expand all Loading... |
34 net_log_.BeginEvent(NetLog::TYPE_SOCKET_ALIVE, | 34 net_log_.BeginEvent(NetLog::TYPE_SOCKET_ALIVE, |
35 source.ToEventParametersCallback()); | 35 source.ToEventParametersCallback()); |
36 } | 36 } |
37 | 37 |
38 TCPSocketLibevent::~TCPSocketLibevent() { | 38 TCPSocketLibevent::~TCPSocketLibevent() { |
39 if (socket_ != kInvalidSocket) | 39 if (socket_ != kInvalidSocket) |
40 Close(); | 40 Close(); |
41 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE); | 41 net_log_.EndEvent(NetLog::TYPE_SOCKET_ALIVE); |
42 } | 42 } |
43 | 43 |
44 int TCPSocketLibevent::Create(AddressFamily family) { | 44 int TCPSocketLibevent::Open(AddressFamily family) { |
45 DCHECK(CalledOnValidThread()); | 45 DCHECK(CalledOnValidThread()); |
46 DCHECK_EQ(socket_, kInvalidSocket); | 46 DCHECK_EQ(socket_, kInvalidSocket); |
47 | 47 |
48 socket_ = CreatePlatformSocket(ConvertAddressFamily(family), SOCK_STREAM, | 48 socket_ = CreatePlatformSocket(ConvertAddressFamily(family), SOCK_STREAM, |
49 IPPROTO_TCP); | 49 IPPROTO_TCP); |
50 if (socket_ < 0) { | 50 if (socket_ < 0) { |
51 PLOG(ERROR) << "CreatePlatformSocket() returned an error"; | 51 PLOG(ERROR) << "CreatePlatformSocket() returned an error"; |
52 return MapSystemError(errno); | 52 return MapSystemError(errno); |
53 } | 53 } |
54 | 54 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 accept_callback_.Reset(); | 242 accept_callback_.Reset(); |
243 callback.Run(result); | 243 callback.Run(result); |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 void TCPSocketLibevent::OnFileCanWriteWithoutBlocking(int fd) { | 247 void TCPSocketLibevent::OnFileCanWriteWithoutBlocking(int fd) { |
248 NOTREACHED(); | 248 NOTREACHED(); |
249 } | 249 } |
250 | 250 |
251 } // namespace net | 251 } // namespace net |
OLD | NEW |