| @@ 708-723 (lines=16) @@ | ||
| 705 | $deferred = new Promise\Deferred; |
|
| 706 | $internalFlow = new Flow\Envelope($flow, $deferred, $packet, $isSilent); |
|
| 707 | ||
| 708 | if ($packet !== NULL) { |
|
| 709 | if ($this->writtenFlow !== NULL) { |
|
| 710 | $this->sendingFlows[] = $internalFlow; |
|
| 711 | ||
| 712 | } else { |
|
| 713 | $this->stream->write($packet); |
|
| 714 | $this->writtenFlow = $internalFlow; |
|
| 715 | ||
| 716 | $this->handleSend(); |
|
| 717 | } |
|
| 718 | ||
| 719 | } else { |
|
| 720 | $this->loop->nextTick(function () use ($internalFlow) { |
|
| 721 | $this->finishFlow($internalFlow); |
|
| 722 | }); |
|
| 723 | } |
|
| 724 | ||
| 725 | return $deferred->promise(); |
|
| 726 | } |
|
| @@ 747-762 (lines=16) @@ | ||
| 744 | return; |
|
| 745 | } |
|
| 746 | ||
| 747 | if ($response !== NULL) { |
|
| 748 | if ($this->writtenFlow !== NULL) { |
|
| 749 | $this->sendingFlows[] = $flow; |
|
| 750 | ||
| 751 | } else { |
|
| 752 | $this->stream->write($response); |
|
| 753 | $this->writtenFlow = $flow; |
|
| 754 | ||
| 755 | $this->handleSend(); |
|
| 756 | } |
|
| 757 | ||
| 758 | } elseif ($flow->isFinished()) { |
|
| 759 | $this->loop->nextTick(function () use ($flow) { |
|
| 760 | $this->finishFlow($flow); |
|
| 761 | }); |
|
| 762 | } |
|
| 763 | } |
|
| 764 | ||
| 765 | /** |
|