summaryrefslogtreecommitdiff
path: root/cc3200/telnet
diff options
context:
space:
mode:
authorDaniel Campora <daniel@wipy.io>2015-03-25 13:29:50 +0100
committerDaniel Campora <daniel@wipy.io>2015-03-25 15:22:21 +0100
commit684dba40f03e3b78cabf3a20c563d2913384edc2 (patch)
treefdff73cc17d75b2cf293fc536d211131ad57d0d8 /cc3200/telnet
parente15f8198bc9efa85bfb9ec50ce7a0a0166e69989 (diff)
cc3200: Roll back to the previous telnet and ftp timeouts.
Unfortunately, these timeouts are the only realiable way (for now), to be able to detect broken connections due to half-open sockets. Such a thing occurs when getting out of the WiFi coverage area or when disconnecting from the AP (sometimes the client doesn't send the disconnect packet).
Diffstat (limited to 'cc3200/telnet')
-rw-r--r--cc3200/telnet/telnet.c17
-rw-r--r--cc3200/telnet/telnet.h1
2 files changed, 9 insertions, 9 deletions
diff --git a/cc3200/telnet/telnet.c b/cc3200/telnet/telnet.c
index 1b4b5783a..ece15c6c7 100644
--- a/cc3200/telnet/telnet.c
+++ b/cc3200/telnet/telnet.c
@@ -48,7 +48,7 @@
#define TELNET_TX_RETRIES_MAX 25
#define TELNET_WAIT_TIME_MS 5
#define TELNET_LOGIN_RETRIES_MAX 3
-#define TELNET_TIMEOUT_MS 1800000 // 30 minutes
+#define TELNET_TIMEOUT_MS 300000 // 5 minutes
#define TELNET_CYCLE_TIME_MS (SERVERS_CYCLE_TIME_MS * 2)
/******************************************************************************
@@ -131,6 +131,7 @@ static telnet_result_t telnet_recv_text_non_blocking (void *buff, _i16 Maxlen, _
static void telnet_process (void);
static void telnet_parse_input (uint8_t *str, int16_t *len);
static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len);
+static void telnet_reset (void);
static void telnet_reset_buffer (void);
/******************************************************************************
@@ -290,13 +291,6 @@ void telnet_disable (void) {
telnet_data.state = E_TELNET_STE_DISABLED;
}
-void telnet_reset (void) {
- // close the connection and start all over again
- servers_close_socket(&telnet_data.n_sd);
- servers_close_socket(&telnet_data.sd);
- telnet_data.state = E_TELNET_STE_START;
-}
-
bool telnet_is_enabled (void) {
return telnet_data.enabled;
}
@@ -476,6 +470,13 @@ static bool telnet_send_with_retries (int16_t sd, const void *pBuf, int16_t len)
return false;
}
+static void telnet_reset (void) {
+ // close the connection and start all over again
+ servers_close_socket(&telnet_data.n_sd);
+ servers_close_socket(&telnet_data.sd);
+ telnet_data.state = E_TELNET_STE_START;
+}
+
static void telnet_reset_buffer (void) {
memset (telnet_data.rxBuffer, '\b', TELNET_RX_BUFFER_SIZE / 2);
telnet_data.rxWindex = TELNET_RX_BUFFER_SIZE / 2;
diff --git a/cc3200/telnet/telnet.h b/cc3200/telnet/telnet.h
index 983a774c8..913cd73e1 100644
--- a/cc3200/telnet/telnet.h
+++ b/cc3200/telnet/telnet.h
@@ -38,7 +38,6 @@ extern bool telnet_rx_any (void);
extern int telnet_rx_char (void);
extern void telnet_enable (void);
extern void telnet_disable (void);
-extern void telnet_reset (void);
extern bool telnet_is_enabled (void);
extern bool telnet_is_active (void);