mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-15 10:29:47 +00:00
3 files changed
+8
-7
No files matched your search
+1
-1
@@ -9691,9 +9691,9 @@ static size_t txq_next(struct connstate *s, uint8_t **buf) {
|
||||
}
|
||||
|
||||
static bool txq_add(struct connstate *s, const void *buf, size_t len) {
|
||||
assert(len > 0);
|
||||
uint32_t n = (uint32_t) len;
|
||||
size_t off = s->txq.len, total = sizeof(n) + len;
|
||||
assert(len > 0);
|
||||
if (mg_iobuf_add(&s->txq, off, NULL, total) != total) return false;
|
||||
memcpy(s->txq.buf + off, &n, sizeof(n));
|
||||
memcpy(s->txq.buf + off + sizeof(n), buf, len);
|
||||
|
||||
+1
-1
@@ -1433,9 +1433,9 @@ static size_t txq_next(struct connstate *s, uint8_t **buf) {
|
||||
}
|
||||
|
||||
static bool txq_add(struct connstate *s, const void *buf, size_t len) {
|
||||
assert(len > 0);
|
||||
uint32_t n = (uint32_t) len;
|
||||
size_t off = s->txq.len, total = sizeof(n) + len;
|
||||
assert(len > 0);
|
||||
if (mg_iobuf_add(&s->txq, off, NULL, total) != total) return false;
|
||||
memcpy(s->txq.buf + off, &n, sizeof(n));
|
||||
memcpy(s->txq.buf + off + sizeof(n), buf, len);
|
||||
|
||||
+6
-5
@@ -981,8 +981,9 @@ static void test_tcp_retransmit_queue(void) {
|
||||
struct ipp ipp;
|
||||
struct tcp *t = (struct tcp *) (s_driver_data.buf + sizeof(e) + sizeof(ip));
|
||||
struct connstate *s;
|
||||
size_t i, first, off, len = 0, retired;
|
||||
size_t i, first, off, retired;
|
||||
uint8_t *data;
|
||||
uint32_t qlen = 0;
|
||||
struct mg_tcpip_driver driver;
|
||||
struct mg_tcpip_if mif;
|
||||
|
||||
@@ -1075,12 +1076,12 @@ static void test_tcp_retransmit_queue(void) {
|
||||
while (s->seq - s->txq_una < s_rtx_len) {
|
||||
while (!received_response(&s_driver_data)) mg_mgr_poll(&mgr, 0);
|
||||
}
|
||||
for (off = 0; off < s->txq.len; off += sizeof(uint32_t) + len) {
|
||||
memcpy(&len, s->txq.buf + off, sizeof(uint32_t));
|
||||
for (off = 0; off < s->txq.len; off += sizeof(qlen) + qlen) {
|
||||
memcpy(&qlen, s->txq.buf + off, sizeof(qlen));
|
||||
}
|
||||
ASSERT(off == s->txq.len);
|
||||
ASSERT(len == first);
|
||||
ASSERT(memcmp(s->txq.buf + off - len, s_rtx_data + first, len) == 0);
|
||||
ASSERT(qlen == first);
|
||||
ASSERT(memcmp(s->txq.buf + off - qlen, s_rtx_data + first, qlen) == 0);
|
||||
|
||||
// Draining waits for the rebuilt flight to be acknowledged before FIN
|
||||
mgr.conns->is_draining = 1;
|
||||
|
||||
Reference in new issue
Block a user