| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/socket_posix.h" | 5 #include "net/socket/socket_posix.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <netinet/in.h> | 8 #include <netinet/in.h> |
| 9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return ERR_CONNECTION_FAILED; // More specific than ERR_FAILED. | 53 return ERR_CONNECTION_FAILED; // More specific than ERR_FAILED. |
| 54 return net_error; | 54 return net_error; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 SocketPosix::SocketPosix() | 61 SocketPosix::SocketPosix() |
| 62 : socket_fd_(kInvalidSocket), | 62 : socket_fd_(kInvalidSocket), |
| 63 accept_socket_watcher_(FROM_HERE), |
| 64 read_socket_watcher_(FROM_HERE), |
| 63 read_buf_len_(0), | 65 read_buf_len_(0), |
| 66 write_socket_watcher_(FROM_HERE), |
| 64 write_buf_len_(0), | 67 write_buf_len_(0), |
| 65 waiting_connect_(false) {} | 68 waiting_connect_(false) {} |
| 66 | 69 |
| 67 SocketPosix::~SocketPosix() { | 70 SocketPosix::~SocketPosix() { |
| 68 Close(); | 71 Close(); |
| 69 } | 72 } |
| 70 | 73 |
| 71 int SocketPosix::Open(int address_family) { | 74 int SocketPosix::Open(int address_family) { |
| 72 DCHECK(thread_checker_.CalledOnValidThread()); | 75 DCHECK(thread_checker_.CalledOnValidThread()); |
| 73 DCHECK_EQ(kInvalidSocket, socket_fd_); | 76 DCHECK_EQ(kInvalidSocket, socket_fd_); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 write_buf_ = NULL; | 513 write_buf_ = NULL; |
| 511 write_buf_len_ = 0; | 514 write_buf_len_ = 0; |
| 512 write_callback_.Reset(); | 515 write_callback_.Reset(); |
| 513 } | 516 } |
| 514 | 517 |
| 515 waiting_connect_ = false; | 518 waiting_connect_ = false; |
| 516 peer_address_.reset(); | 519 peer_address_.reset(); |
| 517 } | 520 } |
| 518 | 521 |
| 519 } // namespace net | 522 } // namespace net |
| OLD | NEW |