From e477d8cffaf99465dc6815230e6b01ebe1f87b26 Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Sat, 16 Mar 2013 12:33:50 +0100 Subject: Fixed issu con client.available to return the correct number of bytes --- firmwares/wifishield/wifiHD/src/ard_utils.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'firmwares/wifishield/wifiHD/src/ard_utils.c') diff --git a/firmwares/wifishield/wifiHD/src/ard_utils.c b/firmwares/wifishield/wifiHD/src/ard_utils.c index 39c19dd..7bff763 100644 --- a/firmwares/wifishield/wifiHD/src/ard_utils.c +++ b/firmwares/wifishield/wifiHD/src/ard_utils.c @@ -78,6 +78,8 @@ uint16_t calcMergeLen(uint8_t sock) if (pBufStore[index][sock].data != NULL) { len += pBufStore[index][sock].len; + len -= pBufStore[index][sock].idx; + INFO_UTIL_VER(" [%d]: len:%d idx:%d tot:%d\n", sock, pBufStore[index][sock].len, pBufStore[index][sock].idx, len); } ++index; if (index == MAX_PBUF_STORED) -- cgit v1.2.3-18-g5258 From f0ba738a71ec8dafe4705ddd02c07a2eb880655c Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Sun, 17 Mar 2013 19:23:16 +0100 Subject: Fix issue related to multiple client opened on web server sketch --- firmwares/wifishield/wifiHD/src/ard_utils.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/ard_utils.c') diff --git a/firmwares/wifishield/wifiHD/src/ard_utils.c b/firmwares/wifishield/wifiHD/src/ard_utils.c index 7bff763..c2937d8 100644 --- a/firmwares/wifishield/wifiHD/src/ard_utils.c +++ b/firmwares/wifishield/wifiHD/src/ard_utils.c @@ -181,7 +181,8 @@ void dumpPbuf(uint8_t sock) do { if (pBufStore[index][sock].data != NULL) { - printk("Buf: %p Len:%d\n", pBufStore[index][sock].data, pBufStore[index][sock].len); + printk("%d] pcb:%p Buf: %p Len:%d\n", pBufStore[index][sock].idx, pBufStore[index][sock].pcb, + pBufStore[index][sock].data, pBufStore[index][sock].len); } ++index; if (index == MAX_PBUF_STORED) @@ -247,7 +248,7 @@ void ack_recved(void* pcb, int len); void ackAndFreeData(void* pcb, int len, uint8_t sock, uint8_t* data) { - INFO_UTIL("Ack pcb:%p len:%d sock:%d data:%p\n", pcb, len, sock, data); + INFO_TCP("Ack pcb:%p len:%d sock:%d data:%p\n", pcb, len, sock, data); if (!IS_UDP_SOCK(sock)) ack_recved(pcb, len); if (data != NULL) @@ -278,7 +279,7 @@ bool isAvailTcpDataByte(uint8_t sock) uint16_t getAvailTcpDataByte(uint8_t sock) { uint16_t len = calcMergeLen(sock); - INFO_UTIL("Availabled data: %d\n", len); + INFO_UTIL_VER("Availabled data: %d\n", len); return len; } @@ -298,6 +299,8 @@ bool getTcpDataByte(uint8_t sock, uint8_t* payload, uint8_t peek) else *payload = buf[p->idx++]; INFO_UTIL_VER("get:%d %p %d\n",p->idx, p->data, *payload); + if (p->idx == p->len) + ackAndFreeData(p->pcb, p->len, sock, p->data); return true; }else{ ackAndFreeData(p->pcb, p->len, sock, p->data); -- cgit v1.2.3-18-g5258