1 | <?php |
||
24 | class SslDataFlushEventHandler implements EventHandlerInterface |
||
25 | { |
||
26 | /** |
||
27 | * Next handler |
||
28 | * |
||
29 | * @var EventHandlerInterface|null |
||
30 | */ |
||
31 | private $next; |
||
32 | |||
33 | /** |
||
34 | * Array of socket descriptors currently in flush |
||
35 | * |
||
36 | * @var bool[] |
||
37 | */ |
||
38 | private $inFlushingOperations = []; |
||
39 | |||
40 | /** |
||
41 | * SslDataFlushEventHandler constructor. |
||
42 | * |
||
43 | * @param EventHandlerInterface|null $next Next event handler |
||
44 | */ |
||
45 | 7 | public function __construct(EventHandlerInterface $next = null) |
|
49 | |||
50 | /** {@inheritdoc} */ |
||
51 | 7 | public function invokeEvent(Event $event) |
|
66 | |||
67 | /** |
||
68 | * Handle first data alert and try to flush ssl data by empty frame |
||
69 | * |
||
70 | * @param DataAlertEvent $event Event object |
||
71 | * |
||
72 | * @return void |
||
73 | */ |
||
74 | 2 | private function onDataAlert(DataAlertEvent $event) |
|
90 | |||
91 | /** |
||
92 | * Handle read data |
||
93 | * |
||
94 | * @param ReadEvent $event Read event |
||
95 | * |
||
96 | * @return void |
||
97 | */ |
||
98 | 5 | private function onRead(ReadEvent $event) |
|
109 | |||
110 | /** |
||
111 | * Call next event handler |
||
112 | * |
||
113 | * @param Event $event Event object |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | 6 | private function callNextHandler(Event $event) |
|
123 | } |
||
124 |