| | | |
Offset 452, 128 lines modified | Offset 452, 119 lines modified |
452 | ············}]); | 452 | ············}]); |
| |
453 | ············return·BufferList; | 453 | ············return·BufferList; |
454 | ········}(); | 454 | ········}(); |
455 | ····return·buffer_list; | 455 | ····return·buffer_list; |
456 | } | 456 | } |
| |
457 | var·destroy_1; | |
458 | var·hasRequiredDestroy; | 457 | function·destroy(err,·cb)·{ |
| 458 | ····var·_this·=·this; |
| |
| 459 | ····var·readableDestroyed·=·this._readableState·&&·this._readableState.destroyed; |
| 460 | ····var·writableDestroyed·=·this._writableState·&&·this._writableState.destroyed; |
459 | function·requireDestroy()·{ | |
460 | ····if·(hasRequiredDestroy)·return·destroy_1; | |
461 | ····hasRequiredDestroy·=·1; | |
| |
462 | ····function·destroy(err,·cb)·{ | |
463 | ········var·_this·=·this; | |
| |
464 | ········var·readableDestroyed·=·this._readableState·&&·this._readableState.destroyed; | |
465 | ········var·writableDestroyed·=·this._writableState·&&·this._writableState.destroyed; | |
| |
466 | ········if·(readableDestroyed·||·writableDestroyed)·{ | 461 | ····if·(readableDestroyed·||·writableDestroyed)·{ |
467 | ············if·(cb)·{ | 462 | ········if·(cb)·{ |
468 | ················cb(err); | 463 | ············cb(err); |
469 | ············}·else·if·(err)·{ | 464 | ········}·else·if·(err)·{ |
470 | ················if·(!this._writableState)·{ | 465 | ············if·(!this._writableState)·{ |
471 | ····················process.nextTick(emitErrorNT,·this,·err); | 466 | ················process.nextTick(emitErrorNT,·this,·err); |
472 | ················}·else·if·(!this._writableState.errorEmitted)·{ | 467 | ············}·else·if·(!this._writableState.errorEmitted)·{ |
473 | ····················this._writableState.errorEmitted·=·true; | 468 | ················this._writableState.errorEmitted·=·true; |
474 | ····················process.nextTick(emitErrorNT,·this,·err); | 469 | ················process.nextTick(emitErrorNT,·this,·err); |
475 | ················} | |
476 | ············} | 470 | ············} |
| 471 | ········} |
| |
477 | ············return·this; | 472 | ········return·this; |
478 | ········}·//·we·set·destroyed·to·true·before·firing·error·callbacks·in·order | 473 | ····}·//·we·set·destroyed·to·true·before·firing·error·callbacks·in·order |
479 | ········//·to·make·it·re-entrance·safe·in·case·destroy()·is·called·within·callbacks | 474 | ····//·to·make·it·re-entrance·safe·in·case·destroy()·is·called·within·callbacks |
| |
| |
480 | ········if·(this._readableState)·{ | 475 | ····if·(this._readableState)·{ |
481 | ············this._readableState.destroyed·=·true; | 476 | ········this._readableState.destroyed·=·true; |
482 | ········}·//·if·this·is·a·duplex·stream·mark·the·writable·part·as·destroyed·as·well | 477 | ····}·//·if·this·is·a·duplex·stream·mark·the·writable·part·as·destroyed·as·well |
| |
| |
483 | ········if·(this._writableState)·{ | 478 | ····if·(this._writableState)·{ |
484 | ············this._writableState.destroyed·=·true; | 479 | ········this._writableState.destroyed·=·true; |
485 | ········} | 480 | ····} |
| |
486 | ········this._destroy(err·||·null,·function(err)·{ | 481 | ····this._destroy(err·||·null,·function(err)·{ |
487 | ············if·(!cb·&&·err)·{ | 482 | ········if·(!cb·&&·err)·{ |
488 | ················if·(!_this._writableState)·{ | 483 | ············if·(!_this._writableState)·{ |
489 | ····················process.nextTick(emitErrorAndCloseNT,·_this,·err); | 484 | ················process.nextTick(emitErrorAndCloseNT,·_this,·err); |
490 | ················}·else·if·(!_this._writableState.errorEmitted)·{ | 485 | ············}·else·if·(!_this._writableState.errorEmitted)·{ |
491 | ····················_this._writableState.errorEmitted·=·true; | 486 | ················_this._writableState.errorEmitted·=·true; |
492 | ····················process.nextTick(emitErrorAndCloseNT,·_this,·err); | 487 | ················process.nextTick(emitErrorAndCloseNT,·_this,·err); |
493 | ················}·else·{ | |
494 | ····················process.nextTick(emitCloseNT,·_this); | |
495 | ················} | |
496 | ············}·else·if·(cb)·{ | |
497 | ················process.nextTick(emitCloseNT,·_this); | |
498 | ················cb(err); | |
499 | ············}·else·{ | 488 | ············}·else·{ |
500 | ················process.nextTick(emitCloseNT,·_this); | 489 | ················process.nextTick(emitCloseNT,·_this); |
501 | ············} | 490 | ············} |
| 491 | ········}·else·if·(cb)·{ |
| 492 | ············process.nextTick(emitCloseNT,·_this); |
| 493 | ············cb(err); |
| 494 | ········}·else·{ |
| 495 | ············process.nextTick(emitCloseNT,·_this); |
502 | ········}); | 496 | ········} |
| |
503 | ········return·this; | |
504 | ····} | 497 | ····}); |
| |
505 | ····function·emitErrorAndCloseNT(self,·err)·{ | |
506 | ········emitErrorNT(self,·err); | |
507 | ········emitCloseNT(self); | |
508 | ····} | |
| |
| 498 | ····return·this; |
| 499 | } |
509 | ····function·emitCloseNT(self)·{ | |
510 | ········if·(self._writableState·&&·!self._writableState.emitClose)·return; | |
511 | ········if·(self._readableState·&&·!self._readableState.emitClose)·return; | |
512 | ········self.emit('close'); | |
513 | ····} | |
| |
| 500 | function·emitErrorAndCloseNT(self,·err)·{ |
| 501 | ····emitErrorNT(self,·err); |
| 502 | ····emitCloseNT(self); |
| 503 | } |
514 | ····function·undestroy()·{ | |
515 | ········if·(this._readableState)·{ | |
516 | ············this._readableState.destroyed·=·false; | |
517 | ············this._readableState.reading·=·false; | |
518 | ············this._readableState.ended·=·false; | |
519 | ············this._readableState.endEmitted·=·false; | |
520 | ········} | |
| |
| 504 | function·emitCloseNT(self)·{ |
| 505 | ····if·(self._writableState·&&·!self._writableState.emitClose)·return; |
| 506 | ····if·(self._readableState·&&·!self._readableState.emitClose)·return; |
| 507 | ····self.emit('close'); |
| 508 | } |
521 | ········if·(this._writableState)·{ | |
522 | ············this._writableState.destroyed·=·false; | |
523 | ············this._writableState.ended·=·false; | |
524 | ············this._writableState.ending·=·false; | |
525 | ············this._writableState.finalCalled·=·false; | |
526 | ············this._writableState.prefinished·=·false; | |
527 | ············this._writableState.finished·=·false; | |
528 | ············this._writableState.errorEmitted·=·false; | |
529 | ········} | |
530 | ····} | |
| |
531 | ····function·emitErrorNT(self,·err)·{ | |
532 | ········self.emit('error',·err); | 509 | function·undestroy()·{ |
| 510 | ····if·(this._readableState)·{ |
| 511 | ········this._readableState.destroyed·=·false; |
| 512 | ········this._readableState.reading·=·false; |
| 513 | ········this._readableState.ended·=·false; |
| 514 | ········this._readableState.endEmitted·=·false; |
| 515 | ····} |
| |
| 516 | ····if·(this._writableState)·{ |
Max diff block lines reached; 5472/11345 bytes (48.23%) of diff not shown.
|