mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-29 01:57:09 +03:00
coap_send: Do not block on first send when testing for additional support
The first coap_send(pdu) is held back until after the optional tests for Extended Token or Q-Block support are complete with the return from coap_send() containing the held back pdu's mid. If there are any errors with this PDU when subsequentially sent, the event COAP_EVENT_FIRST_PDU_FAIL gets raised.
This commit is contained in:
1 parent
bcee6f7149
commit
19f1d78848
12 files changed
+228
-57
No files matched your search
@@ -110,6 +110,8 @@ typedef enum {
|
||||
COAP_EVENT_BAD_PACKET = 0x5001,
|
||||
/** Triggered when a message is retransmitted */
|
||||
COAP_EVENT_MSG_RETRANSMITTED = 0x5002,
|
||||
/** Triggered when the initial app PDU cannot be transmitted */
|
||||
COAP_EVENT_FIRST_PDU_FAIL = 0x5003,
|
||||
|
||||
/*
|
||||
* OSCORE events
|
||||
|
||||
@@ -1001,6 +1001,14 @@ coap_mid_t coap_send_rst_lkd(coap_session_t *session, const coap_pdu_t *request)
|
||||
void coap_call_response_handler(coap_session_t *session, coap_pdu_t *sent,
|
||||
coap_pdu_t *rcvd, void *body_free);
|
||||
|
||||
/**
|
||||
* Reset doing the first packet state when testing for optional functionality.
|
||||
* This causes any pending PDU to be transmitted.
|
||||
*
|
||||
* @param session The CoAP session.
|
||||
*/
|
||||
void coap_reset_doing_first(coap_session_t *session);
|
||||
|
||||
/**@}*/
|
||||
|
||||
extern int coap_started;
|
||||
|
||||
@@ -142,6 +142,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
struct coap_pdu_t {
|
||||
struct coap_pdu_t *next; /**< Next PDU in a delay chain */
|
||||
coap_pdu_type_t type; /**< message type */
|
||||
coap_pdu_code_t code; /**< request method (value 1--31) or response code
|
||||
(value 64-255) */
|
||||
|
||||
@@ -191,7 +191,9 @@ struct coap_session_t {
|
||||
uint32_t block_mode; /**< Zero or more COAP_BLOCK_ or'd options */
|
||||
uint8_t csm_bert_rem_support; /**< CSM TCP BERT blocks supported (remote) */
|
||||
uint8_t csm_bert_loc_support; /**< CSM TCP BERT blocks supported (local) */
|
||||
#if COAP_CLIENT_SUPPORT
|
||||
uint8_t doing_first; /**< Set if doing client's first request */
|
||||
#endif /* COAP_CLIENT_SUPPORT */
|
||||
uint8_t proxy_session; /**< Set if this is an ongoing proxy session */
|
||||
uint8_t delay_recursive; /**< Set if in coap_client_delay_first() */
|
||||
uint8_t no_observe_cancel; /**< Set if do not cancel observe on session
|
||||
@@ -222,6 +224,8 @@ struct coap_session_t {
|
||||
uint8_t session_failed; /**< Set if session failed and can try re-connect */
|
||||
uint8_t client_initiated; /**< Session initially started as a client */
|
||||
uint8_t retry_count; /**< Number of retries trying to re-connect */
|
||||
coap_tick_t doing_first_timeout; /**< If doing_first, when to timeout */
|
||||
coap_pdu_t *doing_first_pdu; /**< If doing fist, PDU to retry sending */
|
||||
#endif /* COAP_CLIENT_SUPPORT */
|
||||
coap_mid_t remote_test_mid; /**< mid used for checking remote
|
||||
support */
|
||||
|
||||
Reference in new issue
Block a user