mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-29 16:25:54 +08:00
Acquire lock when manipulating rx in SSL recv path
PUBLISHED_FROM=a34cfa3ebc12daf75d7f24c8d3f3707dcc33d9a2
This commit is contained in:
parent
62c896a872
commit
8065439f96
@ -15465,6 +15465,7 @@ int ssl_socket_recv(void *ctx, unsigned char *buf, size_t len) {
|
||||
}
|
||||
size_t seg_len = (seg->len - cs->rx_offset);
|
||||
DBG(("%u %u %u %u", len, cs->rx_chain->len, seg_len, cs->rx_chain->tot_len));
|
||||
mgos_lock();
|
||||
len = MIN(len, seg_len);
|
||||
pbuf_copy_partial(seg, buf, len, cs->rx_offset);
|
||||
cs->rx_offset += len;
|
||||
@ -15476,6 +15477,7 @@ int ssl_socket_recv(void *ctx, unsigned char *buf, size_t len) {
|
||||
pbuf_free(seg);
|
||||
cs->rx_offset = 0;
|
||||
}
|
||||
mgos_unlock();
|
||||
LOG(LL_DEBUG, ("%p <- %d", nc, (int) len));
|
||||
return len;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user