| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "nacl_io/socket/socket_node.h" | 5 #include "nacl_io/socket/socket_node.h" |
| 6 | 6 |
| 7 #include "nacl_io/ossocket.h" | 7 #include "nacl_io/ossocket.h" |
| 8 #ifdef PROVIDES_SOCKET_API | 8 #ifdef PROVIDES_SOCKET_API |
| 9 | 9 |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 | 357 |
| 358 if (TestStreamFlags(SSF_RECV_ENDOFSTREAM)) { | 358 if (TestStreamFlags(SSF_RECV_ENDOFSTREAM)) { |
| 359 *out_len = 0; | 359 *out_len = 0; |
| 360 return 0; | 360 return 0; |
| 361 } | 361 } |
| 362 | 362 |
| 363 int ms = read_timeout_; | 363 int ms = read_timeout_; |
| 364 if ((flags & MSG_DONTWAIT) || !attr.IsBlocking()) | 364 if ((flags & MSG_DONTWAIT) || !attr.IsBlocking()) |
| 365 ms = 0; | 365 ms = 0; |
| 366 | 366 |
| 367 // TODO(noelallen) BUG=295177 | 367 // TODO(bradnelson) BUG=295177 |
| 368 // For UDP we should support filtering packets when using connect | 368 // For UDP we should support filtering packets when using connect |
| 369 EventListenerLock wait(GetEventEmitter()); | 369 EventListenerLock wait(GetEventEmitter()); |
| 370 Error err = wait.WaitOnEvent(POLLIN, ms); | 370 Error err = wait.WaitOnEvent(POLLIN, ms); |
| 371 | 371 |
| 372 // Timeout is treated as a would block for sockets. | 372 // Timeout is treated as a would block for sockets. |
| 373 if (ETIMEDOUT == err) | 373 if (ETIMEDOUT == err) |
| 374 return EWOULDBLOCK; | 374 return EWOULDBLOCK; |
| 375 | 375 |
| 376 if (err) | 376 if (err) |
| 377 return err; | 377 return err; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 return 0; | 480 return 0; |
| 481 } | 481 } |
| 482 | 482 |
| 483 *len = ResourceToSockAddr(local_addr_, *len, addr); | 483 *len = ResourceToSockAddr(local_addr_, *len, addr); |
| 484 return 0; | 484 return 0; |
| 485 } | 485 } |
| 486 | 486 |
| 487 } // namespace nacl_io | 487 } // namespace nacl_io |
| 488 | 488 |
| 489 #endif // PROVIDES_SOCKET_API | 489 #endif // PROVIDES_SOCKET_API |
| OLD | NEW |