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/ossocket.h" | 5 #include "nacl_io/ossocket.h" |
6 #ifdef PROVIDES_SOCKET_API | 6 #ifdef PROVIDES_SOCKET_API |
7 | 7 |
8 #include <assert.h> | 8 #include <assert.h> |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 Error err = wait.WaitOnEvent(POLLOUT, ms); | 473 Error err = wait.WaitOnEvent(POLLOUT, ms); |
474 if (ETIMEDOUT == err) | 474 if (ETIMEDOUT == err) |
475 return EINPROGRESS; | 475 return EINPROGRESS; |
476 | 476 |
477 // If we fail, release the dest addr resource | 477 // If we fail, release the dest addr resource |
478 if (err != 0) { | 478 if (err != 0) { |
479 ConnectFailed_Locked(); | 479 ConnectFailed_Locked(); |
480 return err; | 480 return err; |
481 } | 481 } |
482 | 482 |
| 483 // Make sure the connection succeeded. |
| 484 if (last_errno_ != 0) { |
| 485 ConnectFailed_Locked(); |
| 486 return last_errno_; |
| 487 } |
| 488 |
483 ConnectDone_Locked(); | 489 ConnectDone_Locked(); |
484 return 0; | 490 return 0; |
485 } | 491 } |
486 | 492 |
487 Error TcpNode::Shutdown(int how) { | 493 Error TcpNode::Shutdown(int how) { |
488 AUTO_LOCK(node_lock_); | 494 AUTO_LOCK(node_lock_); |
489 if (!IsConnected()) | 495 if (!IsConnected()) |
490 return ENOTCONN; | 496 return ENOTCONN; |
491 | 497 |
492 { | 498 { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 assert(emitter_.get()); | 562 assert(emitter_.get()); |
557 if (emitter_->GetError_Locked()) | 563 if (emitter_->GetError_Locked()) |
558 return EPIPE; | 564 return EPIPE; |
559 *out_len = emitter_->WriteOut_Locked((char*)buf, len); | 565 *out_len = emitter_->WriteOut_Locked((char*)buf, len); |
560 return 0; | 566 return 0; |
561 } | 567 } |
562 | 568 |
563 } // namespace nacl_io | 569 } // namespace nacl_io |
564 | 570 |
565 #endif // PROVIDES_SOCKET_API | 571 #endif // PROVIDES_SOCKET_API |
OLD | NEW |