Codebase list squeezelite / bcc26ca
add timeout on slimproto connection to detect dead server Adrian Smith 11 years ago
1 changed file(s) with 9 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
420420 u32_t now;
421421 static u32_t last = 0;
422422 event_handle ehandles[2];
423 int timeouts = 0;
423424
424425 set_readwake_handles(ehandles, sock, wake_e);
425426
469470 if (ev == EVENT_WAKE) {
470471 wake = true;
471472 }
473
474 timeouts = 0;
475
476 } else if (++timeouts > 35) {
477
478 // expect message from server every 5 seconds, but 30 seconds on mysb.com so timeout after 35 seconds
479 LOG_INFO("No messages from server - connection dead");
480 return;
472481 }
473482
474483 // update playback state when woken or every 100ms