Skip to content

Commit 0104596

Browse files
Merge pull request #29 from nidzho/master
Configurable sending buffer chunk size
2 parents 4199a8f + 141ffce commit 0104596

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/AfriCC/EPP/Client.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Client
3636
protected $debug;
3737
protected $connect_timeout;
3838
protected $timeout;
39+
protected $chunk_size;
3940

4041
public function __construct(array $config)
4142
{
@@ -100,6 +101,12 @@ public function __construct(array $config)
100101
} else {
101102
$this->timeout = 8;
102103
}
104+
105+
if (!empty($config['chunk_size'])) {
106+
$this->chunk_size = (int) $config['chunk_size'];
107+
} else {
108+
$this->chunk_size = 1024;
109+
}
103110
}
104111

105112
public function __destruct()
@@ -340,8 +347,8 @@ private function send($buffer)
340347
// Some servers don't like alot of data, so keep it small per chunk
341348
$wlen = $length - $pos;
342349

343-
if ($wlen > 1024) {
344-
$wlen = 1024;
350+
if ($wlen > $this->chunk_size) {
351+
$wlen = $this->chunk_size;
345352
}
346353

347354
// try write remaining data from socket

0 commit comments

Comments
 (0)