OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #if !defined(DART_IO_DISABLED) | 5 #if !defined(DART_IO_DISABLED) |
6 | 6 |
7 #include "platform/globals.h" | 7 #include "platform/globals.h" |
8 #if defined(TARGET_OS_WINDOWS) | 8 #if defined(TARGET_OS_WINDOWS) |
9 | 9 |
10 #include "bin/socket.h" | 10 #include "bin/socket.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 const RawAddr& source_addr) { | 243 const RawAddr& source_addr) { |
244 intptr_t fd = Create(addr); | 244 intptr_t fd = Create(addr); |
245 if (fd < 0) { | 245 if (fd < 0) { |
246 return fd; | 246 return fd; |
247 } | 247 } |
248 | 248 |
249 return Connect(fd, addr, source_addr); | 249 return Connect(fd, addr, source_addr); |
250 } | 250 } |
251 | 251 |
252 | 252 |
| 253 bool Socket::IsBindError(intptr_t error_number) { |
| 254 return error_number == WSAEADDRINUSE || error_number == WSAEADDRNOTAVAIL || |
| 255 error_number == WSAEINVAL; |
| 256 } |
| 257 |
| 258 |
253 void Socket::GetError(intptr_t fd, OSError* os_error) { | 259 void Socket::GetError(intptr_t fd, OSError* os_error) { |
254 Handle* handle = reinterpret_cast<Handle*>(fd); | 260 Handle* handle = reinterpret_cast<Handle*>(fd); |
255 os_error->SetCodeAndMessage(OSError::kSystem, handle->last_error()); | 261 os_error->SetCodeAndMessage(OSError::kSystem, handle->last_error()); |
256 } | 262 } |
257 | 263 |
258 | 264 |
259 int Socket::GetType(intptr_t fd) { | 265 int Socket::GetType(intptr_t fd) { |
260 Handle* handle = reinterpret_cast<Handle*>(fd); | 266 Handle* handle = reinterpret_cast<Handle*>(fd); |
261 switch (GetFileType(handle->handle())) { | 267 switch (GetFileType(handle->handle())) { |
262 case FILE_TYPE_CHAR: return File::kTerminal; | 268 case FILE_TYPE_CHAR: return File::kTerminal; |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 reinterpret_cast<char *>(&mreq), | 720 reinterpret_cast<char *>(&mreq), |
715 sizeof(mreq)) == 0; | 721 sizeof(mreq)) == 0; |
716 } | 722 } |
717 | 723 |
718 } // namespace bin | 724 } // namespace bin |
719 } // namespace dart | 725 } // namespace dart |
720 | 726 |
721 #endif // defined(TARGET_OS_WINDOWS) | 727 #endif // defined(TARGET_OS_WINDOWS) |
722 | 728 |
723 #endif // !defined(DART_IO_DISABLED) | 729 #endif // !defined(DART_IO_DISABLED) |
OLD | NEW |