jcs
/subtext
/amendments
/212
serial: If session_create fails, hang up
Maybe we should not put the modem in auto-answer and require manual
ATA, but then only do that if we can establish a session first. That
way we don't waste time negotiating the modem just to hang up.
jcs made amendment 212 over 2 years ago
--- serial.c Wed Jul 13 16:50:31 2022
+++ serial.c Sun Jul 17 00:16:22 2022
@@ -382,9 +382,14 @@ serial_idle(void)
short count, ret;
sprintf(tty, "ttym%d", (db->config.modem_port == 2 ? 1 : 0));
- the_serial_node.connected = true;
the_serial_node.session = session_create(tty, "modem",
&serial_node_funcs);
+ if (the_serial_node.session == NULL) {
+ logger_printf(logger, "[modem] No free nodes, hanging up");
+ serial_reset();
+ return;
+ }
+ the_serial_node.connected = true;
the_serial_node.session->cookie = (void *)&the_serial_node;
the_serial_node.session->vt100 = 1;
/* TODO: pass caller id */