replace the old socket_sendto error message with something more useful so that people stop asking us how to fix it.

This commit is contained in:
Isaac Connor 2016-12-16 09:12:27 -05:00
parent 68cd4c2ce5
commit fe3f3d91ce
1 changed files with 8 additions and 4 deletions

View File

@ -47,13 +47,17 @@ switch ( $_REQUEST['command'] )
$remSockFile = ZM_PATH_SOCKS.'/zms-'.sprintf("%06d",$_REQUEST['connkey']).'s.sock';
$max_socket_tries = 10;
while ( !file_exists($remSockFile) && $max_socket_tries-- ) //sometimes we are too fast for our own good, if it hasn't been setup yet give it a second.
while ( !file_exists($remSockFile) && $max_socket_tries-- ) { //sometimes we are too fast for our own good, if it hasn't been setup yet give it a second.
usleep(200000);
}
if ( !@socket_sendto( $socket, $msg, strlen($msg), 0, $remSockFile ) )
{
if ( !file_exists($remSockFile) ) {
ajaxError("Socket $ramSocketFile does not exist. This file is created by zms, and since it does not exist, either zms did not run, or zms exited early. Please check your zms logs and ensure that CGI is enabled in apache (sudo a2enmod CGI) and check that the PATH_ZMS is set correctly (typically /zm/cgi-bin/nph-zms). Make sure that ZM is actually recording. If you are trying to view a live stream and the capture process (zmc) is not running then zms will exit.");
} else {
if ( !@socket_sendto( $socket, $msg, strlen($msg), 0, $remSockFile ) ) {
ajaxError( "socket_sendto( $remSockFile ) failed: ".socket_strerror(socket_last_error()) );
}
}
$rSockets = array( $socket );
$wSockets = NULL;