A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.
Dependents: oldheating gps motorhome heating
Diff: tcp/tcb.cpp
- Revision:
- 57:e0fb648acf48
- Parent:
- 52:fbc5a46b5e16
--- a/tcp/tcb.cpp Tue Nov 14 17:43:08 2017 +0000 +++ b/tcp/tcb.cpp Tue Nov 28 17:05:46 2017 +0000 @@ -23,7 +23,7 @@ for (int i = 0; i < TCB_COUNT; i++) { struct tcb* pTcb = tcbs + i; - if (pTcb->state != TCB_CLOSED && pTcb->port == port) return pTcb; + if (pTcb->state != TCB_EMPTY && pTcb->port == port) return pTcb; } return NULL; } @@ -32,7 +32,7 @@ for (int i = 0; i < TCB_COUNT; i++) { struct tcb* pTcb = tcbs + i; - if (pTcb->state == TCB_CLOSED) return pTcb; + if (pTcb->state == TCB_EMPTY) return pTcb; } return NULL; } @@ -42,20 +42,21 @@ { static struct tcb* pTcb = tcbs; - if (pTcb->state == TCB_CLOSED) return; + if (pTcb->state == TCB_EMPTY) return; uint32_t limit; switch (pTcb->state) { case TCB_SYN_RECEIVED: limit = TIMEOUT_SYN_RECEIVED; break; case TCB_ESTABLISHED: limit = TIMEOUT_ESTABLISHED; break; - case TCB_CLOSING: limit = TIMEOUT_CLOSING; break; + case TCB_FIN_WAIT: limit = TIMEOUT_CLOSING; break; + case TCB_ACK_WAIT: limit = TIMEOUT_CLOSING; break; } if (TcbElapsed - pTcb->elapsed > limit) { if (TcpTrace) LogTimeF("Reaping TCB %d port %d\r\n", pTcb - tcbs, pTcb->port); - pTcb->state = TCB_CLOSED; + pTcb->state = TCB_EMPTY; } pTcb++; @@ -69,5 +70,5 @@ } void TcbInit() { - for (int i = 0; i < TCB_COUNT; i++) tcbs[i].state = TCB_CLOSED; + for (int i = 0; i < TCB_COUNT; i++) tcbs[i].state = TCB_EMPTY; }