We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5aee90 commit fd12ccdCopy full SHA for fd12ccd
Datagram/Socket.php
@@ -14,12 +14,16 @@ class Socket extends EventEmitter implements SocketInterface
14
15
public $bufferSize = 65536;
16
17
- public function __construct(LoopInterface $loop, $socket)
+ public function __construct(LoopInterface $loop, $socket, Buffer $buffer = null)
18
{
19
$this->loop = $loop;
20
$this->socket = $socket;
21
22
- $this->buffer = new Buffer($loop, $socket);
+ if ($buffer === null) {
23
+ $buffer = new Buffer($loop, $socket);
24
+ }
25
+ $this->buffer = $buffer;
26
+
27
$that = $this;
28
$this->buffer->on('error', function ($error) use ($that) {
29
$that->emit('error', array($error, $that));
0 commit comments