| OLD | NEW |
| 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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 #include "bin/eventhandler.h" | 6 #include "bin/eventhandler.h" |
| 7 #include "bin/socket.h" | 7 #include "bin/socket.h" |
| 8 | 8 |
| 9 bool Socket::Initialize() { | 9 bool Socket::Initialize() { |
| 10 int err; | 10 int err; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 free(buffer); | 204 free(buffer); |
| 205 return NULL; | 205 return NULL; |
| 206 } | 206 } |
| 207 return buffer; | 207 return buffer; |
| 208 } | 208 } |
| 209 | 209 |
| 210 | 210 |
| 211 intptr_t ServerSocket::CreateBindListen(const char* host, | 211 intptr_t ServerSocket::CreateBindListen(const char* host, |
| 212 intptr_t port, | 212 intptr_t port, |
| 213 intptr_t backlog) { | 213 intptr_t backlog) { |
| 214 in_addr_t s_addr = TEMP_FAILURE_RETRY(inet_addr(host)); | 214 unsigned long s_addr = TEMP_FAILURE_RETRY(inet_addr(host)); // NOLINT |
| 215 if (s_addr == INADDR_NONE) { | 215 if (s_addr == INADDR_NONE) { |
| 216 return -5; | 216 return -5; |
| 217 } | 217 } |
| 218 | 218 |
| 219 SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); | 219 SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
| 220 if (s == INVALID_SOCKET) { | 220 if (s == INVALID_SOCKET) { |
| 221 return -1; | 221 return -1; |
| 222 } | 222 } |
| 223 | 223 |
| 224 BOOL optval = true; | 224 BOOL optval = true; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 253 if (status == SOCKET_ERROR) { | 253 if (status == SOCKET_ERROR) { |
| 254 DWORD rc = WSAGetLastError(); | 254 DWORD rc = WSAGetLastError(); |
| 255 closesocket(s); | 255 closesocket(s); |
| 256 SetLastError(rc); | 256 SetLastError(rc); |
| 257 return -1; | 257 return -1; |
| 258 } | 258 } |
| 259 | 259 |
| 260 ListenSocket* listen_socket = new ListenSocket(s); | 260 ListenSocket* listen_socket = new ListenSocket(s); |
| 261 return reinterpret_cast<intptr_t>(listen_socket); | 261 return reinterpret_cast<intptr_t>(listen_socket); |
| 262 } | 262 } |
| OLD | NEW |