mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-18 19:31:02 +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) {
|
static bool txq_add(struct connstate *s, const void *buf, size_t len) {
|
||||||
assert(len > 0);
|
|
||||||
uint32_t n = (uint32_t) len;
|
uint32_t n = (uint32_t) len;
|
||||||
size_t off = s->txq.len, total = sizeof(n) + 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;
|
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, &n, sizeof(n));
|
||||||
memcpy(s->txq.buf + off + sizeof(n), buf, len);
|
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) {
|
static bool txq_add(struct connstate *s, const void *buf, size_t len) {
|
||||||
assert(len > 0);
|
|
||||||
uint32_t n = (uint32_t) len;
|
uint32_t n = (uint32_t) len;
|
||||||
size_t off = s->txq.len, total = sizeof(n) + 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;
|
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, &n, sizeof(n));
|
||||||
memcpy(s->txq.buf + off + sizeof(n), buf, len);
|
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 ipp ipp;
|
||||||
struct tcp *t = (struct tcp *) (s_driver_data.buf + sizeof(e) + sizeof(ip));
|
struct tcp *t = (struct tcp *) (s_driver_data.buf + sizeof(e) + sizeof(ip));
|
||||||
struct connstate *s;
|
struct connstate *s;
|
||||||
size_t i, first, off, len = 0, retired;
|
size_t i, first, off, retired;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
|
uint32_t qlen = 0;
|
||||||
struct mg_tcpip_driver driver;
|
struct mg_tcpip_driver driver;
|
||||||
struct mg_tcpip_if mif;
|
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 (s->seq - s->txq_una < s_rtx_len) {
|
||||||
while (!received_response(&s_driver_data)) mg_mgr_poll(&mgr, 0);
|
while (!received_response(&s_driver_data)) mg_mgr_poll(&mgr, 0);
|
||||||
}
|
}
|
||||||
for (off = 0; off < s->txq.len; off += sizeof(uint32_t) + len) {
|
for (off = 0; off < s->txq.len; off += sizeof(qlen) + qlen) {
|
||||||
memcpy(&len, s->txq.buf + off, sizeof(uint32_t));
|
memcpy(&qlen, s->txq.buf + off, sizeof(qlen));
|
||||||
}
|
}
|
||||||
ASSERT(off == s->txq.len);
|
ASSERT(off == s->txq.len);
|
||||||
ASSERT(len == first);
|
ASSERT(qlen == first);
|
||||||
ASSERT(memcmp(s->txq.buf + off - len, s_rtx_data + first, len) == 0);
|
ASSERT(memcmp(s->txq.buf + off - qlen, s_rtx_data + first, qlen) == 0);
|
||||||
|
|
||||||
// Draining waits for the rebuilt flight to be acknowledged before FIN
|
// Draining waits for the rebuilt flight to be acknowledged before FIN
|
||||||
mgr.conns->is_draining = 1;
|
mgr.conns->is_draining = 1;
|
||||||
|
|||||||
Reference in new issue
Block a user