mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 12:07:09 +03:00
fix reboot logic upon server loss - release
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
idf_component_register(SRC_DIRS . core core/ifaces fonts
|
||||
INCLUDE_DIRS . fonts core
|
||||
REQUIRES platform_config tools esp_common
|
||||
|
||||
@@ -228,7 +228,6 @@ void raop_delete(struct raop_ctx_s *ctx) {
|
||||
ctx->running = false;
|
||||
|
||||
// wake-up thread by connecting socket, needed for freeBSD
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
getsockname(ctx->sock, (struct sockaddr *) &addr, &nlen);
|
||||
connect(sock, (struct sockaddr*) &addr, sizeof(addr));
|
||||
@@ -247,14 +246,17 @@ void raop_delete(struct raop_ctx_s *ctx) {
|
||||
}
|
||||
|
||||
// stop broadcasting devices
|
||||
mdns_service_remove(ctx->svr, ctx->svc);
|
||||
mdnsd_stop(ctx->svr);
|
||||
#else
|
||||
// then the RTSP task
|
||||
ctx->joiner = xTaskGetCurrentTaskHandle();
|
||||
ctx->running = false;
|
||||
|
||||
// brute-force exit of accept()
|
||||
shutdown(ctx->sock, SHUT_RDWR);
|
||||
closesocket(ctx->sock);
|
||||
|
||||
ctx->running = false;
|
||||
|
||||
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||
// wait to make sure LWIP if scheduled (avoid issue with NotifyTake)
|
||||
vTaskDelay(100 / portTICK_PERIOD_MS);
|
||||
ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
|
||||
|
||||
@@ -327,12 +327,12 @@ void register_external(void) {
|
||||
|
||||
void deregister_external(void) {
|
||||
if (!strcasestr(output.device, "BT ") && enable_bt_sink) {
|
||||
bt_sink_deinit();
|
||||
LOG_INFO("Stopping BT sink");
|
||||
bt_sink_deinit();
|
||||
}
|
||||
if (enable_airplay){
|
||||
LOG_INFO("Stopping AirPlay sink");
|
||||
raop_sink_deinit();
|
||||
LOG_INFO("Stopping AirPlay sink");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef unsigned long long u64_t;
|
||||
#define OUTPUT_THREAD_STACK_SIZE 6 * 1024
|
||||
#define IR_THREAD_STACK_SIZE 6 * 1024
|
||||
|
||||
// number of 5s times search for a server will happen beforee slimproto exits (0 = no limit)
|
||||
// number of times the 5s search for a server will happen before slimproto exits (0 = no limit)
|
||||
#define MAX_SERVER_RETRIES 5
|
||||
|
||||
// or can be as simple as #define PLAYER_ID 100
|
||||
|
||||
@@ -962,7 +962,7 @@ void slimproto(log_level level, char *server, u8_t mac[6], const char *name, con
|
||||
if (++failed_connect > 5 && !server) {
|
||||
slimproto_ip = serv_addr.sin_addr.s_addr = discover_server(NULL, MAX_SERVER_RETRIES);
|
||||
if (!slimproto_ip) return;
|
||||
} else if (MAX_SERVER_RETRIES && failed_connect > 5 * MAX_SERVER_RETRIES) return;
|
||||
} else if (reconnect && MAX_SERVER_RETRIES && failed_connect > 5 * MAX_SERVER_RETRIES) return;
|
||||
#else
|
||||
// rediscover server if it was not set at startup or exit
|
||||
if (!server && ++failed_connect > 5) {
|
||||
|
||||
Reference in New Issue
Block a user