net_modem.c: Make sure the CONNECT response gets through
This commit is contained in:
@@ -112,6 +112,7 @@ typedef struct modem_t
|
|||||||
bool connected, ringing;
|
bool connected, ringing;
|
||||||
bool echo, numericresponse;
|
bool echo, numericresponse;
|
||||||
bool tcpIpMode, tcpIpConnInProgress;
|
bool tcpIpMode, tcpIpConnInProgress;
|
||||||
|
bool cooldown;
|
||||||
bool telnet_mode;
|
bool telnet_mode;
|
||||||
bool dtrstate;
|
bool dtrstate;
|
||||||
uint32_t tcpIpConnCounter;
|
uint32_t tcpIpConnCounter;
|
||||||
@@ -369,13 +370,17 @@ host_to_modem_cb(void *priv)
|
|||||||
if (!((modem->serial->mctrl & 2) || modem->flowcontrol != 3))
|
if (!((modem->serial->mctrl & 2) || modem->flowcontrol != 3))
|
||||||
goto no_write_to_machine;
|
goto no_write_to_machine;
|
||||||
|
|
||||||
if (modem->mode == MODEM_MODE_DATA && fifo8_num_used(&modem->rx_data)) {
|
if (modem->mode == MODEM_MODE_DATA && fifo8_num_used(&modem->rx_data) && !modem->cooldown) {
|
||||||
serial_write_fifo(modem->serial, fifo8_pop(&modem->rx_data));
|
serial_write_fifo(modem->serial, fifo8_pop(&modem->rx_data));
|
||||||
} else if (fifo8_num_used(&modem->data_pending)) {
|
} else if (fifo8_num_used(&modem->data_pending)) {
|
||||||
uint8_t val = fifo8_pop(&modem->data_pending);
|
uint8_t val = fifo8_pop(&modem->data_pending);
|
||||||
serial_write_fifo(modem->serial, val);
|
serial_write_fifo(modem->serial, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fifo8_num_used(&modem->data_pending) == 0) {
|
||||||
|
modem->cooldown = false;
|
||||||
|
}
|
||||||
|
|
||||||
no_write_to_machine:
|
no_write_to_machine:
|
||||||
timer_on_auto(&modem->host_to_serial_timer, (1000000.0 / (double)modem->baudrate) * (double)9);
|
timer_on_auto(&modem->host_to_serial_timer, (1000000.0 / (double)modem->baudrate) * (double)9);
|
||||||
}
|
}
|
||||||
@@ -524,6 +529,7 @@ modem_enter_connected_state(modem_t* modem)
|
|||||||
modem->ringing = false;
|
modem->ringing = false;
|
||||||
modem->connected = true;
|
modem->connected = true;
|
||||||
modem->tcpIpMode = true;
|
modem->tcpIpMode = true;
|
||||||
|
modem->cooldown = true;
|
||||||
plat_netsocket_close(modem->serversocket);
|
plat_netsocket_close(modem->serversocket);
|
||||||
modem->serversocket = -1;
|
modem->serversocket = -1;
|
||||||
memset(&modem->telClient, 0, sizeof(modem->telClient));
|
memset(&modem->telClient, 0, sizeof(modem->telClient));
|
||||||
|
Reference in New Issue
Block a user