Skip to content

Commit

Permalink
feat(espconn): Add function to get readable data bytes of TCP
Browse files Browse the repository at this point in the history
internal gitlab: 994d80fb
  • Loading branch information
wujiangang committed Jun 26, 2018
1 parent 236b6d0 commit 3d634f6
Show file tree
Hide file tree
Showing 4 changed files with 30 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 : 60d9a8f0
lwip : 12cc0794
mbedtls : e4dace14
8 changes: 8 additions & 0 deletions include/espconn.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,14 @@ sint8 espconn_recv_hold(struct espconn *pespconn);
*******************************************************************************/
sint8 espconn_recv_unhold(struct espconn *pespconn);

/******************************************************************************
* FunctionName : espconn_recved_len
* Description : get TCP readable data bytes
* Parameters : espconn -- espconn to unhold
* Returns : result
*******************************************************************************/
sint16 espconn_recved_len(struct espconn *espconn);

/******************************************************************************
* FunctionName : espconn_mdns_init
* Description : register a device with mdns
Expand Down
Binary file modified lib/liblwip.a
Binary file not shown.
21 changes: 21 additions & 0 deletions third_party/lwip/app/espconn.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,27 @@ sint16 ICACHE_FLASH_ATTR espconn_recv(struct espconn *espconn, void *mem, size_t
return ESPCONN_ARG;
}

sint16 ICACHE_FLASH_ATTR espconn_recved_len(struct espconn *espconn)
{
espconn_msg *pnode = NULL;
bool value = false;

if (espconn == NULL)
return ESPCONN_ARG;

/*Find the node depend on the espconn message*/
value = espconn_find_connection(espconn, &pnode);
if (value && espconn->type == ESPCONN_TCP){
if (pnode->readbuf != NULL){
return (sint16)ringbuf_bytes_used(pnode->readbuf);
} else{
return 0;
}
}

return ESPCONN_ARG;
}

/******************************************************************************
* FunctionName : espconn_sendto
* Description : send data for UDP
Expand Down

0 comments on commit 3d634f6

Please sign in to comment.