|
@@ -1105,6 +1105,8 @@ espconn_set_opt(struct espconn *espconn, uint8 opt)
|
|
|
if (value) {
|
|
|
pnode->pcommon.espconn_opt |= opt;
|
|
|
tpcb = pnode->pcommon.pcb;
|
|
|
+ if (NULL == tpcb)
|
|
|
+ return ESPCONN_OK;
|
|
|
if (espconn_delay_disabled(pnode))
|
|
|
tcp_nagle_disable(tpcb);
|
|
|
|
|
@@ -1143,7 +1145,8 @@ espconn_clear_opt(struct espconn *espconn, uint8 opt)
|
|
|
tpcb = pnode->pcommon.pcb;
|
|
|
if (espconn_keepalive_enabled(pnode))
|
|
|
espconn_keepalive_disable(tpcb);
|
|
|
-
|
|
|
+ if (NULL == tpcb)
|
|
|
+ return ESPCONN_OK;
|
|
|
if (espconn_delay_enabled(pnode))
|
|
|
tcp_nagle_enable(tpcb);
|
|
|
|
|
@@ -1176,6 +1179,8 @@ sint8 ICACHE_FLASH_ATTR espconn_set_keepalive(struct espconn *espconn, uint8 lev
|
|
|
value = espconn_find_connection(espconn, &pnode);
|
|
|
if (value && espconn_keepalive_disabled(pnode)) {
|
|
|
struct tcp_pcb *pcb = pnode->pcommon.pcb;
|
|
|
+ if (NULL == pcb)
|
|
|
+ return ESPCONN_OK;
|
|
|
switch (level){
|
|
|
case ESPCONN_KEEPIDLE:
|
|
|
pcb->keep_idle = 1000 * (u32_t)(*(int*)optarg);
|
|
@@ -1221,6 +1226,8 @@ sint8 ICACHE_FLASH_ATTR espconn_get_keepalive(struct espconn *espconn, uint8 lev
|
|
|
value = espconn_find_connection(espconn, &pnode);
|
|
|
if (value && espconn_keepalive_disabled(pnode)) {
|
|
|
struct tcp_pcb *pcb = pnode->pcommon.pcb;
|
|
|
+ if (NULL == pcb)
|
|
|
+ return ESPCONN_OK;
|
|
|
switch (level) {
|
|
|
case ESPCONN_KEEPIDLE:
|
|
|
*(int*)optarg = (int)(pcb->keep_idle/1000);
|