124 $httpd->add_handler('action.json', 'function', 'ajax_request_handler'); |
124 $httpd->add_handler('action.json', 'function', 'ajax_request_handler'); |
125 $httpd->add_handler('artwork', 'function', 'artwork_request_handler'); |
125 $httpd->add_handler('artwork', 'function', 'artwork_request_handler'); |
126 $httpd->add_handler('scripts', 'dir', GREY_ROOT . '/scripts'); |
126 $httpd->add_handler('scripts', 'dir', GREY_ROOT . '/scripts'); |
127 $httpd->add_handler('favicon.ico', 'file', GREY_ROOT . '/amarok_icon.ico'); |
127 $httpd->add_handler('favicon.ico', 'file', GREY_ROOT . '/amarok_icon.ico'); |
128 $httpd->add_handler('apple-touch-icon.png', 'file', GREY_ROOT . '/apple-touch-icon.png'); |
128 $httpd->add_handler('apple-touch-icon.png', 'file', GREY_ROOT . '/apple-touch-icon.png'); |
|
129 $httpd->add_handler('spacer.gif', 'file', GREY_ROOT . '/spacer.gif'); |
129 // load all themes if forking is enabled |
130 // load all themes if forking is enabled |
130 // Themes are loaded when the playlist is requested. This is fine for |
131 // Themes are loaded when the playlist is requested. This is fine for |
131 // single-threaded operation, but if the playlist handler is only loaded |
132 // single-threaded operation, but if the playlist handler is only loaded |
132 // in a child process, we need to preload all themes into the parent before |
133 // in a child process, we need to preload all themes into the parent before |
133 // children can respond to theme resource requests. |
134 // children can respond to theme resource requests. |
153 status("Entering main server loop - ^C to interrupt, listening on port $port"); |
154 status("Entering main server loop - ^C to interrupt, listening on port $port"); |
154 $httpd->serve(); |
155 $httpd->serve(); |
155 } |
156 } |
156 catch( Exception $e ) |
157 catch( Exception $e ) |
157 { |
158 { |
158 if ( strstr(strval($e), "Could not bind") ) |
159 if ( strstr(strval($e), "Could not bind") || strstr(strval($e), "Address already in use") ) |
159 { |
160 { |
160 burnout("Could not bind to the port $ip:$port. Is Greyhound already running? Sometimes browsers don't close off their connections until Greyhound has been dead for about a minute, so try starting Greyhound again in roughly 60 seconds. If that doesn't work, type \"killall -9 php\" at a terminal and try starting Greyhound again in 60 seconds."); |
161 burnout("Could not bind to the port $ip:$port. Is Greyhound already running? Sometimes browsers don't close off their connections until Greyhound has been dead for about a minute, so try starting Greyhound again in roughly 60 seconds. If that doesn't work, type \"killall -9 php\" at a terminal and try starting Greyhound again in 60 seconds."); |
161 } |
162 } |
162 burnout("Exception caught while running webserver:\n$e"); |
163 burnout("Exception caught while running webserver:\n$e"); |
163 } |
164 } |