FreeCalypso > hg > themwi-system-sw
comparison mncc/extsock.c @ 28:660126bd5f59
themwi-mncc: fix one bug, add debug syslog output
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 28 Jun 2022 21:47:04 -0800 |
parents | c6572f4c31d2 |
children |
comparison
equal
deleted
inserted
replaced
27:c6572f4c31d2 | 28:660126bd5f59 |
---|---|
15 #include "../include/mncc.h" | 15 #include "../include/mncc.h" |
16 #include "../include/gsm48_const.h" | 16 #include "../include/gsm48_const.h" |
17 #include "struct.h" | 17 #include "struct.h" |
18 #include "gsm_call.h" | 18 #include "gsm_call.h" |
19 | 19 |
20 extern char *mncc_msg_name(); | |
21 | |
20 void | 22 void |
21 extsock_dec_refcount(conn) | 23 extsock_dec_refcount(conn) |
22 struct socket_conn *conn; | 24 struct socket_conn *conn; |
23 { | 25 { |
24 if (!conn->ncalls) { | 26 if (!conn->ncalls) { |
50 | 52 |
51 for (call = call_list_head; call; call = call->next) { | 53 for (call = call_list_head; call; call = call->next) { |
52 if (call->gc_flag) | 54 if (call->gc_flag) |
53 continue; | 55 continue; |
54 if (call->socket == conn) { | 56 if (call->socket == conn) { |
57 syslog(LOG_WARNING, | |
58 "clearing broken socket call: GSM callref 0x%x, socket ref 0x%x", | |
59 call->callref, call->socket_ref); | |
55 send_rel_on_broken_socket(call); | 60 send_rel_on_broken_socket(call); |
56 extsock_dec_refcount(conn); | 61 extsock_dec_refcount(conn); |
57 call->gc_flag = 1; | 62 call->gc_flag = 1; |
58 } | 63 } |
59 } | 64 } |
83 | 88 |
84 if (msglen < sizeof(struct gsm_mncc)) { | 89 if (msglen < sizeof(struct gsm_mncc)) { |
85 report_runt(msg); | 90 report_runt(msg); |
86 return; | 91 return; |
87 } | 92 } |
93 syslog(LOG_DEBUG, "Rx MNCC_SETUP_REQ from socket, callref=0x%x", | |
94 msg->callref); | |
88 call = find_socket_call(conn, msg->callref); | 95 call = find_socket_call(conn, msg->callref); |
89 if (call) { | 96 if (call) { |
90 syslog(LOG_ERR, | 97 syslog(LOG_ERR, |
91 "duplicate MNCC_SETUP_REQ from socket for callref 0x%x", | 98 "duplicate MNCC_SETUP_REQ from socket for callref 0x%x", |
92 msg->callref); | 99 msg->callref); |
107 | 114 |
108 if (msglen < sizeof(struct gsm_mncc)) { | 115 if (msglen < sizeof(struct gsm_mncc)) { |
109 report_runt(msg); | 116 report_runt(msg); |
110 return; | 117 return; |
111 } | 118 } |
119 syslog(LOG_DEBUG, "Rx %s from socket, callref=0x%x", | |
120 mncc_msg_name(msg->msg_type), msg->callref); | |
112 call = find_socket_call(conn, msg->callref); | 121 call = find_socket_call(conn, msg->callref); |
113 if (!call) { | 122 if (!call) { |
114 syslog(LOG_ERR, | 123 syslog(LOG_ERR, |
115 "MNCC message from ThemWi call socket: callref 0x%x not found", | 124 "MNCC message from ThemWi call socket: callref 0x%x not found", |
116 msg->callref); | 125 msg->callref); |
136 | 145 |
137 if (msglen < sizeof(struct gsm_mncc_rtp)) { | 146 if (msglen < sizeof(struct gsm_mncc_rtp)) { |
138 report_runt(msg); | 147 report_runt(msg); |
139 return; | 148 return; |
140 } | 149 } |
150 syslog(LOG_DEBUG, "Rx %s from socket, callref=0x%x", | |
151 mncc_msg_name(msg->msg_type), msg->callref); | |
141 call = find_socket_call(conn, msg->callref); | 152 call = find_socket_call(conn, msg->callref); |
142 if (!call) { | 153 if (!call) { |
143 syslog(LOG_ERR, | 154 syslog(LOG_ERR, |
144 "MNCC message from ThemWi call socket: callref 0x%x not found", | 155 "MNCC message from ThemWi call socket: callref 0x%x not found", |
145 msg->callref); | 156 msg->callref); |
158 union mncc_msg msg; | 169 union mncc_msg msg; |
159 int rc; | 170 int rc; |
160 | 171 |
161 rc = recv(conn->fd, &msg, sizeof msg, 0); | 172 rc = recv(conn->fd, &msg, sizeof msg, 0); |
162 if (rc < 4) { | 173 if (rc < 4) { |
163 if (conn->ncalls) | 174 if (conn->ncalls) { |
175 syslog(LOG_ERR, "ext socket broken with calls present"); | |
164 broken_socket_clear_calls(conn); | 176 broken_socket_clear_calls(conn); |
177 } else | |
178 syslog(LOG_INFO, "normal closing of ext socket"); | |
165 close(conn->fd); | 179 close(conn->fd); |
166 conn->fd = -1; | 180 conn->fd = -1; |
167 return; | 181 return; |
168 } | 182 } |
169 switch (msg.msg_type) { | 183 switch (msg.msg_type) { |