| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 hint.ai_protocol = IPPROTO_TCP; | 121 hint.ai_protocol = IPPROTO_TCP; |
| 122 int result = ::getaddrinfo(host, port, &hint, &info); | 122 int result = ::getaddrinfo(host, port, &hint, &info); |
| 123 if (result != 0) { | 123 if (result != 0) { |
| 124 return false; | 124 return false; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Connect to the host on the given port. | 127 // Connect to the host on the given port. |
| 128 for (struct addrinfo* ai = info; ai != NULL; ai = ai->ai_next) { | 128 for (struct addrinfo* ai = info; ai != NULL; ai = ai->ai_next) { |
| 129 // Try to connect using this addr info. | 129 // Try to connect using this addr info. |
| 130 while (true) { | 130 while (true) { |
| 131 result = ::connect(native_handle_, ai->ai_addr, ai->ai_addrlen); | 131 result = ::connect( |
| 132 native_handle_, ai->ai_addr, static_cast<int>(ai->ai_addrlen)); |
| 132 if (result == 0) { | 133 if (result == 0) { |
| 133 freeaddrinfo(info); | 134 freeaddrinfo(info); |
| 134 return true; | 135 return true; |
| 135 } | 136 } |
| 136 #if V8_OS_POSIX | 137 #if V8_OS_POSIX |
| 137 if (errno == EINTR) continue; // Retry after signal. | 138 if (errno == EINTR) continue; // Retry after signal. |
| 138 #endif | 139 #endif |
| 139 break; | 140 break; |
| 140 } | 141 } |
| 141 } | 142 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 #elif V8_OS_WIN | 215 #elif V8_OS_WIN |
| 215 // Be sure to initialize the WinSock DLL first. | 216 // Be sure to initialize the WinSock DLL first. |
| 216 CallOnce(&initialize_winsock, &InitializeWinsock); | 217 CallOnce(&initialize_winsock, &InitializeWinsock); |
| 217 | 218 |
| 218 // Now we can safely perform WSA calls. | 219 // Now we can safely perform WSA calls. |
| 219 return ::WSAGetLastError(); | 220 return ::WSAGetLastError(); |
| 220 #endif | 221 #endif |
| 221 } | 222 } |
| 222 | 223 |
| 223 } } // namespace v8::internal | 224 } } // namespace v8::internal |
| OLD | NEW |