Skip to content

Commit

Permalink
fix(espconn): Fix SSL/TLS connection set/clear opt error when using m…
Browse files Browse the repository at this point in the history
…bedtls library

espconn_set_opt should never be called in SSL/TLS connection when using mbedtls library.

internal gitlab: d11ce267
  • Loading branch information
wujiangang committed Apr 19, 2018
1 parent 6b1487e commit 7a6d8eb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ phy:

gitlab:
driver : 68fc7b06
lwip : 3267f12f
lwip : 077057c5
mbedtls : e4dace14
Binary file modified lib/liblwip.a
Binary file not shown.
8 changes: 8 additions & 0 deletions third_party/lwip/app/espconn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,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);

Expand Down Expand Up @@ -1142,6 +1144,8 @@ espconn_clear_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_keepalive_enabled(pnode))
espconn_keepalive_disable(tpcb);

Expand Down Expand Up @@ -1177,6 +1181,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);
Expand Down Expand Up @@ -1222,6 +1228,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);
Expand Down

0 comments on commit 7a6d8eb

Please sign in to comment.