forked from GNUsocial/gnu-social
Added error reporting to SB socket writes and call endSBSession if socket is dead when we try to send a message
This commit is contained in:
parent
6f388a8b50
commit
a665739283
@ -1455,6 +1455,7 @@ class MSN {
|
||||
private function sendMessageViaSB($to, $message) {
|
||||
$socket = $this->switchBoardSessionLookup[$to];
|
||||
if (self::socketcheck($socket)) {
|
||||
$this->endSBSession($socket);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2566,25 +2567,31 @@ X-OIM-Sequence-Num: 1
|
||||
* @param resource $socket SB socket
|
||||
* @param integer $id Reference to SB id
|
||||
* @param string $data Line to write
|
||||
* @return void
|
||||
* @return mixed Bytes written or false on error
|
||||
*/
|
||||
private function sb_writeln($socket, &$id, $data) {
|
||||
@fwrite($socket, $data."\r\n");
|
||||
$result = @fwrite($socket, $data."\r\n");
|
||||
if ($result !== false) {
|
||||
$this->debug_message("SB: >>> $data");
|
||||
$id++;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write data to given SB socket
|
||||
*
|
||||
* @param resource $socket SB socket
|
||||
* @param $data Data to write to socket
|
||||
* @return void
|
||||
* @return mixed Bytes written or false on error
|
||||
*/
|
||||
private function sb_writedata($socket, $data) {
|
||||
@fwrite($socket, $data);
|
||||
$result = @fwrite($socket, $data);
|
||||
if ($result !== false) {
|
||||
$this->debug_message("SB: >>> $data");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the sockets currently in use
|
||||
|
Loading…
x
Reference in New Issue
Block a user