浏览代码

fix reboot logic upon server loss - release

Philippe G 4 年之前
父节点
当前提交
7f1db60c45

+ 0 - 1
components/display/CMakeLists.txt

@@ -1,4 +1,3 @@
-
 idf_component_register(SRC_DIRS . core core/ifaces  fonts
 						INCLUDE_DIRS . fonts core
 						REQUIRES platform_config tools esp_common

+ 6 - 4
components/raop/raop.c

@@ -228,7 +228,6 @@ void raop_delete(struct raop_ctx_s *ctx) {
 	closesocket(sock);
 
 	pthread_join(ctx->thread, NULL);
-
 	rtp_end(ctx->rtp);
 
 	shutdown(ctx->sock, SD_BOTH);
@@ -247,14 +246,17 @@ void raop_delete(struct raop_ctx_s *ctx) {
 	// then the RTSP task
 	ctx->joiner = xTaskGetCurrentTaskHandle();
 	ctx->running = false;
+	
+	// brute-force exit of accept() 
+	shutdown(ctx->sock, SHUT_RDWR);
+	closesocket(ctx->sock);
 
+	// wait to make sure LWIP if scheduled (avoid issue with NotifyTake)	
+	vTaskDelay(100 / portTICK_PERIOD_MS);
 	ulTaskNotifyTake(pdFALSE, portMAX_DELAY);
 	vTaskDelete(ctx->thread);
 	heap_caps_free(ctx->xTaskBuffer);
 
-	shutdown(ctx->sock, SHUT_RDWR);
-	closesocket(ctx->sock);
-	
 	// cleanup all session-created items
 	cleanup_rtsp(ctx, true);
 		

+ 2 - 2
components/squeezelite/decode_external.c

@@ -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");
 	}
 }
 

+ 1 - 1
components/squeezelite/embedded.h

@@ -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

+ 1 - 1
components/squeezelite/slimproto.c

@@ -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) {