Skip to content

Commit d6be6fc

Browse files
committed
Close TCP connections to Graphite to avoid connections in TIME_WAIT state
Resolve: Graphite error: Could not connect: [99] Cannot assign requested address
1 parent fc5d2a4 commit d6be6fc

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.7.3
1+
3.7.4

src/Console/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
*/
5353
class Database extends Command {
5454

55-
const DB_VERSION = '3.7.3';
55+
const DB_VERSION = '3.7.4';
5656

5757
/**
5858
* @var Config

src/TcpSocket.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,16 @@ public function connect(){
7878
}
7979

8080
public function disconnect(){
81-
if(is_resource($this->socket)){
81+
try {
82+
$linger = [
83+
'l_linger' => 0,
84+
'l_onoff' => 1
85+
];
86+
socket_set_option($this->socket, SOL_SOCKET, SO_LINGER, $linger);
87+
//socket_shutdown($this->socket, 2);
8288
socket_close($this->socket);
89+
} catch (\Exception $e) {
90+
// Ignore for now
8391
}
8492
$this->socket = null;
8593
}
@@ -119,4 +127,4 @@ public function getLastError(){
119127
return socket_strerror($this->lastErrNo);
120128
}
121129

122-
}
130+
}

0 commit comments

Comments
 (0)