stream_set_blocking calls were unnecessary

This commit is contained in:
terrafrost 2012-09-09 23:45:18 -05:00
parent 5d91746f73
commit 31ad9aacbd

View File

@ -800,8 +800,6 @@ class Net_SSH2 {
$read = array($this->fsock);
$write = $except = NULL;
stream_set_blocking($this->fsock, false);
$sec = floor($timeout);
$usec = 1000000 * ($timeout - $sec);
@ -812,8 +810,6 @@ class Net_SSH2 {
return;
}
stream_set_blocking($this->fsock, true);
/* According to the SSH2 specs,
"The server MAY send other lines of data before sending the version
@ -2185,21 +2181,16 @@ class Net_SSH2 {
$read = array($this->fsock);
$write = $except = NULL;
stream_set_blocking($this->fsock, false);
$start = strtok(microtime(), ' ') + strtok(''); // http://php.net/microtime#61838
$sec = floor($this->curTimeout);
$usec = 1000000 * ($this->curTimeout - $sec);
// on windows this returns a "Warning: Invalid CRT parameters detected" error
if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) {
stream_set_blocking($this->fsock, true);
$this->_close_channel($client_channel);
return true;
}
$elapsed = strtok(microtime(), ' ') + strtok('') - $start;
$this->curTimeout-= $elapsed;
stream_set_blocking($this->fsock, true);
}
$response = $this->_get_binary_packet();