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

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

Issue 22824005: On Windows, the return value of socket() should be compared with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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 | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 27 matching lines...) Expand all
38 DCHECK_EQ(socket_, INVALID_SOCKET); 38 DCHECK_EQ(socket_, INVALID_SOCKET);
39 DCHECK_EQ(socket_event_, WSA_INVALID_EVENT); 39 DCHECK_EQ(socket_event_, WSA_INVALID_EVENT);
40 40
41 socket_event_ = WSACreateEvent(); 41 socket_event_ = WSACreateEvent();
42 if (socket_event_ == WSA_INVALID_EVENT) { 42 if (socket_event_ == WSA_INVALID_EVENT) {
43 PLOG(ERROR) << "WSACreateEvent()"; 43 PLOG(ERROR) << "WSACreateEvent()";
44 return ERR_FAILED; 44 return ERR_FAILED;
45 } 45 }
46 46
47 socket_ = socket(address.GetSockAddrFamily(), SOCK_STREAM, IPPROTO_TCP); 47 socket_ = socket(address.GetSockAddrFamily(), SOCK_STREAM, IPPROTO_TCP);
48 if (socket_ < 0) { 48 if (socket_ == INVALID_SOCKET) {
wtc 2013/08/12 17:31:30 See the "Return value" section and example code in
49 PLOG(ERROR) << "socket() returned an error"; 49 PLOG(ERROR) << "socket() returned an error";
50 return MapSystemError(WSAGetLastError()); 50 return MapSystemError(WSAGetLastError());
51 } 51 }
52 52
53 if (SetNonBlocking(socket_)) { 53 if (SetNonBlocking(socket_)) {
54 int result = MapSystemError(WSAGetLastError()); 54 int result = MapSystemError(WSAGetLastError());
55 Close(); 55 Close();
56 return result; 56 return result;
57 } 57 }
58 58
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (result != ERR_IO_PENDING) { 208 if (result != ERR_IO_PENDING) {
209 accept_socket_ = NULL; 209 accept_socket_ = NULL;
210 CompletionCallback callback = accept_callback_; 210 CompletionCallback callback = accept_callback_;
211 accept_callback_.Reset(); 211 accept_callback_.Reset();
212 callback.Run(result); 212 callback.Run(result);
213 } 213 }
214 } 214 }
215 } 215 }
216 216
217 } // namespace net 217 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698