| 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 | |
| 259 void Socket::GetError(intptr_t fd, OSError* os_error) { | 253 void Socket::GetError(intptr_t fd, OSError* os_error) { |
| 260 Handle* handle = reinterpret_cast<Handle*>(fd); | 254 Handle* handle = reinterpret_cast<Handle*>(fd); |
| 261 os_error->SetCodeAndMessage(OSError::kSystem, handle->last_error()); | 255 os_error->SetCodeAndMessage(OSError::kSystem, handle->last_error()); |
| 262 } | 256 } |
| 263 | 257 |
| 264 | 258 |
| 265 int Socket::GetType(intptr_t fd) { | 259 int Socket::GetType(intptr_t fd) { |
| 266 Handle* handle = reinterpret_cast<Handle*>(fd); | 260 Handle* handle = reinterpret_cast<Handle*>(fd); |
| 267 switch (GetFileType(handle->handle())) { | 261 switch (GetFileType(handle->handle())) { |
| 268 case FILE_TYPE_CHAR: return File::kTerminal; | 262 case FILE_TYPE_CHAR: return File::kTerminal; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 reinterpret_cast<char *>(&mreq), | 714 reinterpret_cast<char *>(&mreq), |
| 721 sizeof(mreq)) == 0; | 715 sizeof(mreq)) == 0; |
| 722 } | 716 } |
| 723 | 717 |
| 724 } // namespace bin | 718 } // namespace bin |
| 725 } // namespace dart | 719 } // namespace dart |
| 726 | 720 |
| 727 #endif // defined(TARGET_OS_WINDOWS) | 721 #endif // defined(TARGET_OS_WINDOWS) |
| 728 | 722 |
| 729 #endif // !defined(DART_IO_DISABLED) | 723 #endif // !defined(DART_IO_DISABLED) |
| OLD | NEW |