mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
With UIP_CONF_MAX_CONNECTIONS set to one, a verified upload can leave reset intent set when its response is never acknowledged. A subsequent TCP connection reuses that slot, and ACKing its plain GET response can otherwise trigger reset_chip(). This is sequential slot reuse, not concurrent HTTP connections. Store reset intent in the connection appstate and initialize both tstate and fw_reset_pending on every uip_connected() event, regardless of stale appstate contents. Reset only after the verified upload response is fully acknowledged. Exercise the real HTTP callback for all stale tstate bytes, sequential slot reuse and a later GET, partial/final ACKs, abort, timeout and CRC failure. Keep the regression tests in the existing tab-indented style.
27 lines
778 B
C
27 lines
778 B
C
#ifndef __HTTPD_H__
|
|
#define __HTTPD_H__
|
|
|
|
/* Since this file will be included by uip.h, we cannot include uip.h
|
|
here. But we might need to include uipopt.h if we need the u8_t and
|
|
u16_t datatypes. */
|
|
#include "uipopt.h"
|
|
|
|
/* Next, we define the uip_tcp_appstate_t datatype. This is the state
|
|
of our application, and the memory required for this state is
|
|
allocated together with each TCP connection. One application state
|
|
for each TCP connection. */
|
|
typedef struct httpd_state {
|
|
uint8_t tstate;
|
|
uint8_t fw_reset_pending;
|
|
} uip_tcp_appstate_t;
|
|
|
|
/* Finally we define the application function to be called by uIP. */
|
|
void httpd_appcall(void);
|
|
#ifndef UIP_APPCALL
|
|
#define UIP_APPCALL httpd_appcall
|
|
#endif /* UIP_APPCALL */
|
|
|
|
void httpd_init(void) __banked;
|
|
|
|
#endif
|