| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (!IsValid()) { | 231 if (!IsValid()) { |
| 232 return false; | 232 return false; |
| 233 } | 233 } |
| 234 | 234 |
| 235 sockaddr_in addr; | 235 sockaddr_in addr; |
| 236 memset(&addr, 0, sizeof(addr)); | 236 memset(&addr, 0, sizeof(addr)); |
| 237 addr.sin_family = AF_INET; | 237 addr.sin_family = AF_INET; |
| 238 addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); | 238 addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); |
| 239 addr.sin_port = htons(port); | 239 addr.sin_port = htons(port); |
| 240 int status = bind(socket_, | 240 int status = bind(socket_, |
| 241 reinterpret_cast<struct sockaddr *>(&addr), | 241 BitCast<struct sockaddr *>(&addr), |
| 242 sizeof(addr)); | 242 sizeof(addr)); |
| 243 return status == 0; | 243 return status == 0; |
| 244 } | 244 } |
| 245 | 245 |
| 246 | 246 |
| 247 bool POSIXSocket::Listen(int backlog) const { | 247 bool POSIXSocket::Listen(int backlog) const { |
| 248 if (!IsValid()) { | 248 if (!IsValid()) { |
| 249 return false; | 249 return false; |
| 250 } | 250 } |
| 251 | 251 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 return ntohl(value); | 353 return ntohl(value); |
| 354 } | 354 } |
| 355 | 355 |
| 356 | 356 |
| 357 Socket* OS::CreateSocket() { | 357 Socket* OS::CreateSocket() { |
| 358 return new POSIXSocket(); | 358 return new POSIXSocket(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 | 361 |
| 362 } } // namespace v8::internal | 362 } } // namespace v8::internal |
| OLD | NEW |