mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-10 19:00:40 +03:00
coap_write_session: Account correctly for partial TCP writes
Fix the buffer start offset when writing the next part of the PDU. Also correctly report the number of bytes actually written,
This commit is contained in:
1 parent
df9071c93e
commit
bdf7686613
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -325,7 +325,7 @@ ssize_t coap_session_write(coap_session_t *session, const uint8_t *data, size_t
|
||||
if (bytes_written > 0) {
|
||||
coap_ticks(&session->last_rx_tx);
|
||||
coap_log(LOG_DEBUG, "* %s: sent %zd bytes\n",
|
||||
coap_session_str(session), datalen);
|
||||
coap_session_str(session), bytes_written);
|
||||
} else if (bytes_written < 0) {
|
||||
coap_log(LOG_DEBUG, "* %s: failed to send %zd bytes\n",
|
||||
coap_session_str(session), datalen );
|
||||
|
||||
@@ -1487,7 +1487,7 @@ coap_write_session(coap_context_t *ctx, coap_session_t *session, coap_tick_t now
|
||||
#if !COAP_DISABLE_TCP
|
||||
bytes_written = coap_session_write(
|
||||
session,
|
||||
q->pdu->token - q->pdu->hdr_size - session->partial_write,
|
||||
q->pdu->token - q->pdu->hdr_size + session->partial_write,
|
||||
q->pdu->used_size + q->pdu->hdr_size - session->partial_write
|
||||
);
|
||||
#endif /* !COAP_DISABLE_TCP */
|
||||
|
||||
Reference in new issue
Block a user