@@ -102,7 +102,6 @@ function OutgoingMessage() {
102
102
this [ kIsCorked ] = false ;
103
103
104
104
this . socket = null ;
105
- this . connection = null ;
106
105
this . _header = null ;
107
106
this [ kOutHeaders ] = null ;
108
107
@@ -157,6 +156,15 @@ Object.defineProperty(OutgoingMessage.prototype, '_headers', {
157
156
} , 'OutgoingMessage.prototype._headers is deprecated' , 'DEP0066' )
158
157
} ) ;
159
158
159
+ Object . defineProperty ( OutgoingMessage . prototype , 'connection' , {
160
+ get : function ( ) {
161
+ return this . socket ;
162
+ } ,
163
+ set : function ( val ) {
164
+ this . socket = val ;
165
+ }
166
+ } ) ;
167
+
160
168
Object . defineProperty ( OutgoingMessage . prototype , '_headerNames' , {
161
169
get : internalUtil . deprecate ( function ( ) {
162
170
const headers = this [ kOutHeaders ] ;
@@ -273,7 +281,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback) {
273
281
274
282
OutgoingMessage . prototype . _writeRaw = _writeRaw ;
275
283
function _writeRaw ( data , encoding , callback ) {
276
- const conn = this . connection ;
284
+ const conn = this . socket ;
277
285
if ( conn && conn . destroyed ) {
278
286
// The socket was destroyed. If we're still trying to write to it,
279
287
// then we haven't gotten the 'close' event yet.
@@ -615,10 +623,10 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
615
623
[ 'string' , 'Buffer' ] , chunk ) ;
616
624
}
617
625
618
- if ( ! fromEnd && msg . connection && ! msg [ kIsCorked ] ) {
619
- msg . connection . cork ( ) ;
626
+ if ( ! fromEnd && msg . socket && ! msg [ kIsCorked ] ) {
627
+ msg . socket . cork ( ) ;
620
628
msg [ kIsCorked ] = true ;
621
- process . nextTick ( connectionCorkNT , msg , msg . connection ) ;
629
+ process . nextTick ( connectionCorkNT , msg , msg . socket ) ;
622
630
}
623
631
624
632
var len , ret ;
@@ -706,8 +714,8 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
706
714
else
707
715
this . _contentLength = chunk . length ;
708
716
}
709
- if ( this . connection ) {
710
- this . connection . cork ( ) ;
717
+ if ( this . socket ) {
718
+ this . socket . cork ( ) ;
711
719
uncork = true ;
712
720
}
713
721
write_ ( this , chunk , encoding , null , true ) ;
@@ -729,16 +737,16 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
729
737
}
730
738
731
739
if ( uncork )
732
- this . connection . uncork ( ) ;
740
+ this . socket . uncork ( ) ;
733
741
734
742
this . finished = true ;
735
743
736
744
// There is the first message on the outgoing queue, and we've sent
737
745
// everything to the socket.
738
746
debug ( 'outgoing message end.' ) ;
739
747
if ( this . outputData . length === 0 &&
740
- this . connection &&
741
- this . connection . _httpMessage === this ) {
748
+ this . socket &&
749
+ this . socket . _httpMessage === this ) {
742
750
this . _finish ( ) ;
743
751
}
744
752
@@ -747,7 +755,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
747
755
748
756
749
757
OutgoingMessage . prototype . _finish = function _finish ( ) {
750
- assert ( this . connection ) ;
758
+ assert ( this . socket ) ;
751
759
this . emit ( 'prefinish' ) ;
752
760
} ;
753
761
0 commit comments