Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: net/socket/tcp_server_socket_win.cc

Issue 6930014: Rename ClientSocket to StreamSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket/tcp_server_socket_win.h ('k') | net/socket/transport_client_socket_pool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/socket/tcp_server_socket_win.h" 5 #include "net/socket/tcp_server_socket_win.h"
6 6
7 #include <mstcpip.h> 7 #include <mstcpip.h>
8 8
9 #include "net/base/ip_endpoint.h" 9 #include "net/base/ip_endpoint.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 struct sockaddr* addr = reinterpret_cast<struct sockaddr*>(&addr_storage); 92 struct sockaddr* addr = reinterpret_cast<struct sockaddr*>(&addr_storage);
93 if (getsockname(socket_, addr, &addr_len)) 93 if (getsockname(socket_, addr, &addr_len))
94 return MapSystemError(WSAGetLastError()); 94 return MapSystemError(WSAGetLastError());
95 if (!address->FromSockAddr(addr, addr_len)) 95 if (!address->FromSockAddr(addr, addr_len))
96 return ERR_FAILED; 96 return ERR_FAILED;
97 97
98 return OK; 98 return OK;
99 } 99 }
100 100
101 int TCPServerSocketWin::Accept( 101 int TCPServerSocketWin::Accept(
102 scoped_ptr<ClientSocket>* socket, CompletionCallback* callback) { 102 scoped_ptr<StreamSocket>* socket, CompletionCallback* callback) {
103 DCHECK(CalledOnValidThread()); 103 DCHECK(CalledOnValidThread());
104 DCHECK(socket); 104 DCHECK(socket);
105 DCHECK(callback); 105 DCHECK(callback);
106 DCHECK(!accept_callback_); 106 DCHECK(!accept_callback_);
107 107
108 net_log_.BeginEvent(NetLog::TYPE_TCP_ACCEPT, NULL); 108 net_log_.BeginEvent(NetLog::TYPE_TCP_ACCEPT, NULL);
109 109
110 int result = AcceptInternal(socket); 110 int result = AcceptInternal(socket);
111 111
112 if (result == ERR_IO_PENDING) { 112 if (result == ERR_IO_PENDING) {
113 // Start watching 113 // Start watching
114 WSAEventSelect(socket_, socket_event_, FD_ACCEPT); 114 WSAEventSelect(socket_, socket_event_, FD_ACCEPT);
115 accept_watcher_.StartWatching(socket_event_, this); 115 accept_watcher_.StartWatching(socket_event_, this);
116 116
117 accept_socket_ = socket; 117 accept_socket_ = socket;
118 accept_callback_ = callback; 118 accept_callback_ = callback;
119 } 119 }
120 120
121 return result; 121 return result;
122 } 122 }
123 123
124 int TCPServerSocketWin::AcceptInternal(scoped_ptr<ClientSocket>* socket) { 124 int TCPServerSocketWin::AcceptInternal(scoped_ptr<StreamSocket>* socket) {
125 struct sockaddr_storage addr_storage; 125 struct sockaddr_storage addr_storage;
126 socklen_t addr_len = sizeof(addr_storage); 126 socklen_t addr_len = sizeof(addr_storage);
127 struct sockaddr* addr = reinterpret_cast<struct sockaddr*>(&addr_storage); 127 struct sockaddr* addr = reinterpret_cast<struct sockaddr*>(&addr_storage);
128 128
129 int result = accept(socket_, addr, &addr_len); 129 int result = accept(socket_, addr, &addr_len);
130 if (result < 0) { 130 if (result < 0) {
131 int net_error = MapSystemError(WSAGetLastError()); 131 int net_error = MapSystemError(WSAGetLastError());
132 if (net_error != ERR_IO_PENDING) 132 if (net_error != ERR_IO_PENDING)
133 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error); 133 net_log_.EndEventWithNetErrorCode(NetLog::TYPE_TCP_ACCEPT, net_error);
134 return net_error; 134 return net_error;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (result != ERR_IO_PENDING) { 178 if (result != ERR_IO_PENDING) {
179 CompletionCallback* c = accept_callback_; 179 CompletionCallback* c = accept_callback_;
180 accept_callback_ = NULL; 180 accept_callback_ = NULL;
181 accept_socket_ = NULL; 181 accept_socket_ = NULL;
182 c->Run(result); 182 c->Run(result);
183 } 183 }
184 } 184 }
185 } 185 }
186 186
187 } // namespace net 187 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_server_socket_win.h ('k') | net/socket/transport_client_socket_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698