mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-21 23:05:15 +03:00
Duplicate MIDs: If repeat MID request, send back previous response
Clean up duplicate MID handling, and just send back last response if MID matches. Removed COAP_BLOCK_CACHE_RESPONSE as no longer required for duplicate MID handling, and so no need to send an Empty ACK response for a subsequent Separate response as a referenced copy of the last PDU respponse is now kept for a session. Note that if a request is sent by a proxy to an upstream server, this always converts the upstream server's response into a Separate response back to the client as the upstream server may take time to respond, do any error recovery etc.
This commit is contained in:
1 parent
72978e9fc6
commit
94bacc8939
13 files changed
+34
-139
No files matched your search
@@ -71,7 +71,6 @@ typedef struct {
|
||||
#define COAP_BLOCK_STLESS_BLOCK2 0x40 /* (svr)Server is stateless for handling Block2 */
|
||||
#define COAP_BLOCK_NOT_RANDOM_BLOCK1 0x80 /* (svr)Disable server handling random order
|
||||
block1 */
|
||||
#define COAP_BLOCK_CACHE_RESPONSE 0x100 /* (svr)Cache CON request's response */
|
||||
#define COAP_BLOCK_FORCE_Q_BLOCK 0x200 /* force Q-Block method without support check */
|
||||
/* WARNING: Added defined values must not encroach into 0xff000000 which are defined elsewhere */
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ extern "C" {
|
||||
COAP_BLOCK_STLESS_FETCH | \
|
||||
COAP_BLOCK_STLESS_BLOCK2 | \
|
||||
COAP_BLOCK_NOT_RANDOM_BLOCK1 | \
|
||||
COAP_BLOCK_CACHE_RESPONSE | \
|
||||
COAP_BLOCK_FORCE_Q_BLOCK)
|
||||
#else /* ! COAP_Q_BLOCK_SUPPORT */
|
||||
#define COAP_BLOCK_SET_MASK (COAP_BLOCK_USE_LIBCOAP | \
|
||||
@@ -59,8 +58,7 @@ extern "C" {
|
||||
COAP_BLOCK_NO_PREEMPTIVE_RTAG | \
|
||||
COAP_BLOCK_STLESS_FETCH | \
|
||||
COAP_BLOCK_STLESS_BLOCK2 | \
|
||||
COAP_BLOCK_NOT_RANDOM_BLOCK1 | \
|
||||
COAP_BLOCK_CACHE_RESPONSE)
|
||||
COAP_BLOCK_NOT_RANDOM_BLOCK1)
|
||||
#endif /* ! COAP_Q_BLOCK_SUPPORT */
|
||||
|
||||
#define COAP_BLOCK_MAX_SIZE_MASK 0x7000000 /* (svr)Mask to get the max supported block size */
|
||||
@@ -250,7 +248,6 @@ struct coap_lg_srcv_t {
|
||||
uint8_t szx; /**< size of individual blocks */
|
||||
uint16_t block_option; /**< Block option in use */
|
||||
uint8_t dont_timeout; /**< Set if app handler in use */
|
||||
coap_mid_t last_mid; /**< Last received mid for this set of packets */
|
||||
coap_tick_t last_used; /**< Last time data sent or 0 */
|
||||
size_t total_len; /**< Length as indicated by SIZE1 option */
|
||||
coap_binary_t *body_data; /**< Used for re-assembling entire body */
|
||||
|
||||
@@ -240,16 +240,13 @@ struct coap_session_t {
|
||||
uint64_t tx_token; /**< Next token number to use */
|
||||
coap_bin_const_t *last_token; /** last token used to make a request */
|
||||
coap_bin_const_t *echo; /**< Echo value to send with next request */
|
||||
coap_mid_t last_ack_mid; /**< The last ACK mid that has been
|
||||
been processed */
|
||||
coap_mid_t last_con_mid; /**< The last CON mid that has been
|
||||
coap_mid_t last_resp_mid; /**< The last response mid that has been
|
||||
been processed */
|
||||
coap_response_t last_con_handler_res; /**< The result of calling the response handler
|
||||
of the last CON */
|
||||
#if COAP_SERVER_SUPPORT
|
||||
coap_bin_const_t *client_cid; /**< Contains client CID or NULL */
|
||||
coap_pdu_t *cached_pdu; /**< Cached copy of last ACK response PDU */
|
||||
coap_digest_t cached_pdu_cksum; /**< Checksum of last CON request PDU */
|
||||
coap_pdu_t *last_resp_pdu; /**< Cached copy of last ACK response PDU */
|
||||
#endif /* COAP_SERVER_SUPPORT */
|
||||
#if COAP_CLIENT_SUPPORT
|
||||
coap_pdu_t *resp_pdu; /**< PDU returned in coap_send_recv() call */
|
||||
|
||||
Reference in new issue
Block a user