add timeout on slimproto connection to detect dead server
Adrian Smith
11 years ago
420 | 420 | u32_t now; |
421 | 421 | static u32_t last = 0; |
422 | 422 | event_handle ehandles[2]; |
423 | int timeouts = 0; | |
423 | 424 | |
424 | 425 | set_readwake_handles(ehandles, sock, wake_e); |
425 | 426 | |
469 | 470 | if (ev == EVENT_WAKE) { |
470 | 471 | wake = true; |
471 | 472 | } |
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; | |
472 | 481 | } |
473 | 482 | |
474 | 483 | // update playback state when woken or every 100ms |