drivers: modem: modem_socket: Reset all socket data upon socket_put
Some data where not properly reset on socket_put() and not correctly initialized at socket creation. Which means we were potentially re-using data from previous use of this socket. Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
This commit is contained in:
parent
3d61989bc7
commit
900d48c88b
1 changed files with 3 additions and 0 deletions
|
@ -241,6 +241,9 @@ void modem_socket_put(struct modem_socket_config *cfg, int sock_fd)
|
||||||
sock->is_connected = false;
|
sock->is_connected = false;
|
||||||
(void)memset(&sock->src, 0, sizeof(struct sockaddr));
|
(void)memset(&sock->src, 0, sizeof(struct sockaddr));
|
||||||
(void)memset(&sock->dst, 0, sizeof(struct sockaddr));
|
(void)memset(&sock->dst, 0, sizeof(struct sockaddr));
|
||||||
|
memset(&sock->packet_sizes, 0, sizeof(sock->packet_sizes));
|
||||||
|
sock->packet_count = 0;
|
||||||
|
k_sem_reset(&sock->sem_data_ready);
|
||||||
|
|
||||||
k_sem_give(&cfg->sem_lock);
|
k_sem_give(&cfg->sem_lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue