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/base/tcp_client_socket.h" | 5 #include "net/base/tcp_client_socket.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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 close(socket_); | 119 close(socket_); |
120 socket_ = kInvalidSocket; | 120 socket_ = kInvalidSocket; |
121 return MapPosixError(errno); | 121 return MapPosixError(errno); |
122 } | 122 } |
123 | 123 |
124 waiting_connect_ = true; | 124 waiting_connect_ = true; |
125 callback_ = callback; | 125 callback_ = callback; |
126 return ERR_IO_PENDING; | 126 return ERR_IO_PENDING; |
127 } | 127 } |
128 | 128 |
129 int TCPClientSocket::ReconnectIgnoringLastError(CompletionCallback* callback) { | |
130 // No ignorable errors! | |
131 return ERR_UNEXPECTED; | |
132 } | |
133 | |
134 void TCPClientSocket::Disconnect() { | 129 void TCPClientSocket::Disconnect() { |
135 if (socket_ == kInvalidSocket) | 130 if (socket_ == kInvalidSocket) |
136 return; | 131 return; |
137 | 132 |
138 TRACE_EVENT_INSTANT("socket.disconnect", this, ""); | 133 TRACE_EVENT_INSTANT("socket.disconnect", this, ""); |
139 | 134 |
140 socket_watcher_.StopWatchingFileDescriptor(); | 135 socket_watcher_.StopWatchingFileDescriptor(); |
141 close(socket_); | 136 close(socket_); |
142 socket_ = kInvalidSocket; | 137 socket_ = kInvalidSocket; |
143 waiting_connect_ = false; | 138 waiting_connect_ = false; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } else if (write_callback_) { | 363 } else if (write_callback_) { |
369 DidCompleteWrite(); | 364 DidCompleteWrite(); |
370 } | 365 } |
371 } | 366 } |
372 | 367 |
373 int TCPClientSocket::GetPeerName(struct sockaddr *name, socklen_t *namelen) { | 368 int TCPClientSocket::GetPeerName(struct sockaddr *name, socklen_t *namelen) { |
374 return ::getpeername(socket_, name, namelen); | 369 return ::getpeername(socket_, name, namelen); |
375 } | 370 } |
376 | 371 |
377 } // namespace net | 372 } // namespace net |
OLD | NEW |