diff sip-in/mncc_sock.c @ 105:9213ec8b434b

sip-in: handle themwi-mncc shutdown without terminating
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 27 Sep 2022 23:00:52 -0800
parents e5aee661e3b2
children 245dc4837b56
line wrap: on
line diff
--- a/sip-in/mncc_sock.c	Tue Sep 27 21:52:07 2022 -0800
+++ b/sip-in/mncc_sock.c	Tue Sep 27 23:00:52 2022 -0800
@@ -48,10 +48,10 @@
 	int rc;
 
 	rc = recv(gsm_socket, &msg, sizeof msg, 0);
-	if (rc < 0) {
-		syslog(LOG_CRIT, "error reading from mtcall socket: %m");
-		/* GSM disconnect handling to be implemented */
-		exit(1);
+	if (rc <= 0) {
+		syslog(LOG_ERR, "mtcall socket disconnected");
+		shutdown_gsm_conn();
+		gsm_is_connected = 0;
 	}
 	if (rc < 4) {
 		syslog(LOG_CRIT, "short read from mtcall socket: %d bytes", rc);