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.c
- Revision:
- 79:f50e02fb5c94
- Parent:
- 78:9d8fc88df405
- Child:
- 80:4ef1500fca1d
--- a/tcp/tcb.c Mon Nov 05 19:27:19 2018 +0000 +++ b/tcp/tcb.c Sun Nov 11 15:44:23 2018 +0000 @@ -7,10 +7,6 @@ #define TCB_COUNT 10 -#define TIMEOUT_SYN_RECEIVED 2 -#define TIMEOUT_ESTABLISHED 20 -#define TIMEOUT_CLOSING 2 - struct tcb tcbs[TCB_COUNT]; uint32_t TcbGetIsn() @@ -52,35 +48,10 @@ } uint32_t TcbElapsed = 0; -static void reap() -{ - static struct tcb* pTcb = tcbs; - - 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_CLOSE_FIN_WAIT: limit = TIMEOUT_CLOSING; break; - case TCB_CLOSE_ACK_WAIT: limit = TIMEOUT_CLOSING; break; - } - - if (TcbElapsed - pTcb->lastSendTime > limit) - { - if (TcpTrace) LogTimeF("Reaping TCB %d port %d\r\n", pTcb - tcbs, pTcb->remPort); - pTcb->state = TCB_EMPTY; - } - - pTcb++; - if (pTcb >= tcbs + TCB_COUNT) pTcb = tcbs; -} void TcbMain() { if (ClockTicked) TcbElapsed++; - reap(); } void TcbInit() {