Chromium Code Reviews| Index: net/socket/tcp_client_socket_win.cc |
| diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc |
| index aed2adbb85153a41073f2aa1c7659a2b233bde2f..1c69d3ed0293ef655aaba3d4793d58e17a585a51 100644 |
| --- a/net/socket/tcp_client_socket_win.cc |
| +++ b/net/socket/tcp_client_socket_win.cc |
| @@ -373,7 +373,7 @@ int TCPClientSocketWin::Bind(const IPEndPoint& address) { |
| if (!address.ToSockAddr(storage.addr, &storage.addr_len)) |
| return ERR_INVALID_ARGUMENT; |
| - // Create |bound_socket_| and try to bound it to |address|. |
| + // Create |bound_socket_| and try to bind it to |address|. |
| int error = CreateSocket(address.GetFamily(), &bound_socket_); |
| if (error) |
| return MapSystemError(error); |
| @@ -646,8 +646,14 @@ int TCPClientSocketWin::GetPeerAddress(IPEndPoint* address) const { |
| int TCPClientSocketWin::GetLocalAddress(IPEndPoint* address) const { |
| DCHECK(CalledOnValidThread()); |
| DCHECK(address); |
| - if (!IsConnected()) |
| - return ERR_SOCKET_NOT_CONNECTED; |
| + if (socket_ == INVALID_SOCKET) { |
| + if (bind_address_.get()) { |
| + *address = *bind_address_; |
| + return OK; |
| + } else { |
|
wtc
2012/07/19 18:36:36
Nit: omit "else" after a return statement.
Sergey Ulanov
2012/07/19 21:36:20
Done.
|
| + return ERR_SOCKET_NOT_CONNECTED; |
| + } |
| + } |
|
wtc
2012/07/19 18:36:36
If socket_ is INVALID_SOCKET, I think we should si
Sergey Ulanov
2012/07/19 21:36:20
Done.
|
| struct sockaddr_storage addr_storage; |
| socklen_t addr_len = sizeof(addr_storage); |