Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/socket/tcp_node.cc

Issue 657933002: [NaCl SDK] nacl_io: getsockname() should return non-zero port after bind. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 int err = TCPInterface()->Bind( 448 int err = TCPInterface()->Bind(
449 socket_resource_, local_addr_, PP_BlockUntilComplete()); 449 socket_resource_, local_addr_, PP_BlockUntilComplete());
450 450
451 // If we fail, release the local addr resource 451 // If we fail, release the local addr resource
452 if (err != PP_OK) { 452 if (err != PP_OK) {
453 filesystem_->ppapi()->ReleaseResource(local_addr_); 453 filesystem_->ppapi()->ReleaseResource(local_addr_);
454 local_addr_ = 0; 454 local_addr_ = 0;
455 return PPErrorToErrno(err); 455 return PPErrorToErrno(err);
456 } 456 }
457 457
458 local_addr_ = TCPInterface()->GetLocalAddress(socket_resource_);
458 return 0; 459 return 0;
459 } 460 }
460 461
461 Error TcpNode::Connect(const HandleAttr& attr, 462 Error TcpNode::Connect(const HandleAttr& attr,
462 const struct sockaddr* addr, 463 const struct sockaddr* addr,
463 socklen_t len) { 464 socklen_t len) {
464 EventListenerLock wait(GetEventEmitter()); 465 EventListenerLock wait(GetEventEmitter());
465 466
466 if (TestStreamFlags(SSF_CONNECTING)) 467 if (TestStreamFlags(SSF_CONNECTING))
467 return EALREADY; 468 return EALREADY;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 assert(emitter_.get()); 571 assert(emitter_.get());
571 if (emitter_->GetError_Locked()) 572 if (emitter_->GetError_Locked())
572 return EPIPE; 573 return EPIPE;
573 *out_len = emitter_->WriteOut_Locked((char*)buf, len); 574 *out_len = emitter_->WriteOut_Locked((char*)buf, len);
574 return 0; 575 return 0;
575 } 576 }
576 577
577 } // namespace nacl_io 578 } // namespace nacl_io
578 579
579 #endif // PROVIDES_SOCKET_API 580 #endif // PROVIDES_SOCKET_API
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_socket_test/socket_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698