File tree 1 file changed +10
-14
lines changed
1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -674,14 +674,12 @@ Socket.prototype._destroy = function(exception, cb) {
674
674
} ;
675
675
676
676
Socket . prototype . _getpeername = function ( ) {
677
- if ( ! this . _peername ) {
678
- if ( ! this . _handle || ! this . _handle . getpeername ) {
679
- return { } ;
680
- }
681
- const out = { } ;
682
- const err = this . _handle . getpeername ( out ) ;
683
- if ( err ) return { } ; // FIXME(bnoordhuis) Throw?
684
- this . _peername = out ;
677
+ if ( ! this . _handle || ! this . _handle . getpeername ) {
678
+ return this . _peername || { } ;
679
+ } else if ( ! this . _peername ) {
680
+ this . _peername = { } ;
681
+ // FIXME(bnoordhuis) Throw when the return value is not 0?
682
+ this . _handle . getpeername ( this . _peername ) ;
685
683
}
686
684
return this . _peername ;
687
685
} ;
@@ -714,12 +712,10 @@ protoGetter('remotePort', function remotePort() {
714
712
Socket . prototype . _getsockname = function ( ) {
715
713
if ( ! this . _handle || ! this . _handle . getsockname ) {
716
714
return { } ;
717
- }
718
- if ( ! this . _sockname ) {
719
- const out = { } ;
720
- const err = this . _handle . getsockname ( out ) ;
721
- if ( err ) return { } ; // FIXME(bnoordhuis) Throw?
722
- this . _sockname = out ;
715
+ } else if ( ! this . _sockname ) {
716
+ this . _sockname = { } ;
717
+ // FIXME(bnoordhuis) Throw when the return value is not 0?
718
+ this . _handle . getsockname ( this . _sockname ) ;
723
719
}
724
720
return this . _sockname ;
725
721
} ;
You can’t perform that action at this time.
0 commit comments