diff options
-rw-r--r-- | alloc.c | 5 | ||||
-rw-r--r-- | mgmt.c | 7 |
2 files changed, 10 insertions, 2 deletions
@@ -102,6 +102,11 @@ struct mog_rbuf *mog_rbuf_new(size_t size) else rbuf = xmalloc(bytes); rbuf->rcapa = size; + /* + * do not initialize rsize here, we only need rsize when we detach + * a TLS rbuf and associate it with a mog_fd, not in the common + * case where the rbuf remains thread-local + */ return rbuf; } @@ -221,8 +221,11 @@ parse: } else { switch (errno) { case_EAGAIN: - if ((buf_len > 0) && (mgmt->rbuf == NULL)) - mgmt->rbuf = mog_rbuf_detach(rbuf); + if (buf_len > 0) { + if (mgmt->rbuf == NULL) + mgmt->rbuf = mog_rbuf_detach(rbuf); + mgmt->rbuf->rsize = buf_len; + } return MOG_NEXT_WAIT_RD; case EINTR: goto reread; case ECONNRESET: |