mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-29 18:07:08 +03:00
Q-Block: Various Q-Block fixes
This commit is contained in:
1 parent
aaaf3d1324
commit
48a1b83100
3 files changed
+11
-3
No files matched your search
@@ -1492,6 +1492,7 @@ coap_build_missing_pdu(coap_session_t *session, coap_lg_crcv_t *lg_crcv) {
|
||||
size_t len = coap_encode_var_safe8(buf, sizeof(token), token);
|
||||
|
||||
memset(&drop_options, 0, sizeof(coap_opt_filter_t));
|
||||
coap_option_filter_set(&drop_options, COAP_OPTION_Q_BLOCK1);
|
||||
coap_option_filter_set(&drop_options, COAP_OPTION_Q_BLOCK2);
|
||||
coap_option_filter_set(&drop_options, COAP_OPTION_OBSERVE);
|
||||
pdu = coap_pdu_duplicate_lkd(lg_crcv->sent_pdu, session, len, buf,
|
||||
|
||||
+4
-3
@@ -4014,7 +4014,7 @@ skip_handler:
|
||||
/* No delays to response */
|
||||
#if COAP_Q_BLOCK_SUPPORT
|
||||
if (session->block_mode & COAP_BLOCK_USE_LIBCOAP &&
|
||||
!lg_xmit_ctrl && response->code == COAP_RESPONSE_CODE(205) &&
|
||||
!lg_xmit_ctrl && COAP_RESPONSE_CLASS(response->code) == 2 &&
|
||||
coap_get_block_b(session, response, COAP_OPTION_Q_BLOCK2, &block) &&
|
||||
block.m) {
|
||||
if (coap_send_q_block2(session, resource, query, pdu->code, block,
|
||||
@@ -4216,8 +4216,7 @@ handle_response(coap_context_t *context, coap_session_t *session,
|
||||
}
|
||||
#if COAP_Q_BLOCK_SUPPORT
|
||||
/* Check to see if checking out Q-Block support */
|
||||
if (session->block_mode & COAP_BLOCK_PROBE_Q_BLOCK &&
|
||||
session->remote_test_mid == rcvd->mid) {
|
||||
if (session->block_mode & COAP_BLOCK_PROBE_Q_BLOCK) {
|
||||
if (rcvd->code == COAP_RESPONSE_CODE(402)) {
|
||||
coap_log_debug("Q-Block support not available\n");
|
||||
set_block_mode_drop_q(session->block_mode);
|
||||
@@ -4233,6 +4232,8 @@ handle_response(coap_context_t *context, coap_session_t *session,
|
||||
}
|
||||
}
|
||||
session->doing_first = 0;
|
||||
if (rcvd->type == COAP_MESSAGE_CON)
|
||||
coap_send_ack_lkd(session, rcvd);
|
||||
return;
|
||||
}
|
||||
#endif /* COAP_Q_BLOCK_SUPPORT */
|
||||
|
||||
@@ -740,6 +740,12 @@ coap_proxy_call_response_handler(coap_session_t *session, const coap_pdu_t *sent
|
||||
|
||||
proxy_req->mid = resp_pdu->mid;
|
||||
|
||||
/* If sent early ACK, and this is an ACK, need to convert it to CON */
|
||||
if (COAP_PROTO_NOT_RELIABLE(session->proto) && resp_pdu->type == COAP_MESSAGE_ACK &&
|
||||
!(session->block_mode & COAP_BLOCK_CACHE_RESPONSE)) {
|
||||
resp_pdu->type = COAP_MESSAGE_CON;
|
||||
}
|
||||
|
||||
if (coap_get_data_large(rcvd, &size, &data, &offset, &total)) {
|
||||
uint16_t media_type = 0;
|
||||
int maxage = -1;
|
||||
|
||||
Reference in new issue
Block a user