From fe3f3d91ceaba2dbcb4fb6a1523d2c925cc5760d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 16 Dec 2016 09:12:27 -0500 Subject: [PATCH] replace the old socket_sendto error message with something more useful so that people stop asking us how to fix it. --- web/ajax/stream.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/ajax/stream.php b/web/ajax/stream.php index 5e9798011..da6c0133e 100644 --- a/web/ajax/stream.php +++ b/web/ajax/stream.php @@ -47,12 +47,16 @@ 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. - usleep(200000); +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 );