Skip to content

Commit

Permalink
fix: clear buffer before sending
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Dec 1, 2023
1 parent 327dd39 commit 55cc05e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/transport/raweth/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const _zp_raweth_cfg_entry _ZP_RAWETH_CFG_ARRAY[] = {
const _zp_raweth_cfg_whitelist_val _ZP_RAWETH_CFG_WHITELIST[] = {
{{0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}},
{{0x00, 0x11, 0x22, 0x33, 0x44, 0x55}},
{{0x30, 0x03, 0xc8, 0x37, 0x25, 0xa1}},
};

// Don't modify
Expand Down
6 changes: 6 additions & 0 deletions src/transport/raweth/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ int8_t _z_raweth_send_t_msg(_z_transport_multicast_t *ztm, const _z_transport_me
#if Z_FEATURE_MULTI_THREAD == 1
_z_mutex_lock(&ztm->_mutex_tx);
#endif
// Reset wbuf
_z_wbuf_reset(&ztm->_wbuf);
// Set socket info
_Z_RETURN_IF_ERR(_zp_raweth_set_socket(NULL, &ztm->_link._socket._raweth));
// Write the message header
Expand Down Expand Up @@ -234,6 +236,8 @@ int8_t _z_raweth_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg,
default:
break;
}
// Reset wbuf
_z_wbuf_reset(&ztm->_wbuf);
// Set socket info
_Z_RETURN_IF_ERR(_zp_raweth_set_socket(keyexpr, &ztm->_link._socket._raweth));
// Write the eth header
Expand Down Expand Up @@ -263,6 +267,8 @@ int8_t _z_raweth_send_n_msg(_z_session_t *zn, const _z_network_message_t *n_msg,
sn = __unsafe_z_raweth_get_sn(ztm, reliability);
}
is_first = false;
// Reset wbuf
_z_wbuf_reset(&ztm->_wbuf);
// Write the eth header
_Z_RETURN_IF_ERR(__unsafe_z_raweth_write_header(&ztm->_link, &ztm->_wbuf));
// Serialize one fragment
Expand Down

0 comments on commit 55cc05e

Please sign in to comment.