File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,10 @@ Reader.prototype._notifyWindow = function (block){
157
157
158
158
if ( this . _lastReceived ) {
159
159
this . _noMoreData = true ;
160
- return this . _close ( ) ;
160
+ this . _readerTimer . reset ( ) ;
161
+ // RFC 1350 section 6: On the other hand, delaying is encouraged. This means that the host sending the final
162
+ // ACK will wait for a while before terminating in order to retransmit the final ACK if it has been lost
163
+ return setTimeout ( ( ) => this . _close ( ) , 5000 ) ;
161
164
}
162
165
163
166
this . _pending = this . _windowSize ;
@@ -168,9 +171,11 @@ Reader.prototype._notifyWindow = function (block){
168
171
} ;
169
172
170
173
Reader . prototype . _onData = function ( message ) {
171
- //DATA packet received after sending the last packet, the socket will be
172
- //closed in the next tick
173
- if ( this . _noMoreData ) return ;
174
+ //DATA packet received after sending the last packet, the socket is delay-closed so just ACK the client
175
+ if ( this . _noMoreData ) {
176
+ this . _sendAck ( message . block ) ;
177
+ return ;
178
+ }
174
179
175
180
if ( message . block === 0 && this . _rolloverFix === 0 ) {
176
181
//The server has rollovered to 0
You can’t perform that action at this time.
0 commit comments