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

Side by Side Diff: runtime/bin/socket_win.cc

Issue 10032030: Speculative fix for the windows compilation failure. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <winsock2.h> 5 #include <winsock2.h>
6 #include <ws2tcpip.h> 6 #include <ws2tcpip.h>
7 #include <mswsock.h> 7 #include <mswsock.h>
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/eventhandler.h" 10 #include "bin/eventhandler.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd); 60 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd);
61 struct sockaddr_in socket_address; 61 struct sockaddr_in socket_address;
62 socklen_t size = sizeof(socket_address); 62 socklen_t size = sizeof(socket_address);
63 if (getpeername(socket_handle->socket(), 63 if (getpeername(socket_handle->socket(),
64 reinterpret_cast<struct sockaddr *>(&socket_address), 64 reinterpret_cast<struct sockaddr *>(&socket_address),
65 &size)) { 65 &size)) {
66 fprintf(stderr, "Error getpeername: %s\n", strerror(errno)); 66 fprintf(stderr, "Error getpeername: %s\n", strerror(errno));
67 return false; 67 return false;
68 } 68 }
69 if (inet_ntop(socket_address.sin_family, 69 if (inet_ntop(socket_address.sin_family,
70 reinterpret_cast<const void *>(&socket_address.sin_addr), 70 reinterpret_cast<void *>(&socket_address.sin_addr),
71 host, 71 host,
72 INET_ADDRSTRLEN) == NULL) { 72 INET_ADDRSTRLEN) == NULL) {
73 fprintf(stderr, "Error inet_ntop: %s\n", strerror(errno)); 73 fprintf(stderr, "Error inet_ntop: %s\n", strerror(errno));
74 return false; 74 return false;
75 } 75 }
76 *port = ntohs(socket_address.sin_port); 76 *port = ntohs(socket_address.sin_port);
77 return true; 77 return true;
78 78 }
79 79
80 intptr_t Socket::CreateConnect(const char* host, const intptr_t port) { 80 intptr_t Socket::CreateConnect(const char* host, const intptr_t port) {
81 SOCKET s = socket(AF_INET, SOCK_STREAM, 0); 81 SOCKET s = socket(AF_INET, SOCK_STREAM, 0);
82 if (s == INVALID_SOCKET) { 82 if (s == INVALID_SOCKET) {
83 return -1; 83 return -1;
84 } 84 }
85 85
86 linger l; 86 linger l;
87 l.l_onoff = 1; 87 l.l_onoff = 1;
88 l.l_linger = 10; 88 l.l_linger = 10;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 if (status == SOCKET_ERROR) { 243 if (status == SOCKET_ERROR) {
244 DWORD rc = WSAGetLastError(); 244 DWORD rc = WSAGetLastError();
245 closesocket(s); 245 closesocket(s);
246 SetLastError(rc); 246 SetLastError(rc);
247 return -1; 247 return -1;
248 } 248 }
249 249
250 ListenSocket* listen_socket = new ListenSocket(s); 250 ListenSocket* listen_socket = new ListenSocket(s);
251 return reinterpret_cast<intptr_t>(listen_socket); 251 return reinterpret_cast<intptr_t>(listen_socket);
252 } 252 }
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