diff options
| author | Rafael Zalamena <rzalamena@users.noreply.github.com> | 2021-04-29 18:32:52 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-29 18:32:52 -0300 |
| commit | c962ab93a8dd2bb8255c2d5b70de77cb5fec96d4 (patch) | |
| tree | a4d7bae4870c302377b027910a906ce601aa156a /lib/ringbuf.c | |
| parent | 92e36a784a769852ed34e78716bc0080575dee95 (diff) | |
| parent | 338f4a78cc0078e5f59780fe883084c26842157b (diff) | |
Merge pull request #8570 from qlyoung/revert-ringbuf-readv
Revert "bgpd: improve socket read performance"
Diffstat (limited to 'lib/ringbuf.c')
| -rw-r--r-- | lib/ringbuf.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/ringbuf.c b/lib/ringbuf.c index 49221e7cb3..6efa8077c2 100644 --- a/lib/ringbuf.c +++ b/lib/ringbuf.c @@ -131,38 +131,3 @@ void ringbuf_wipe(struct ringbuf *buf) memset(buf->data, 0x00, buf->size); ringbuf_reset(buf); } - -ssize_t ringbuf_read(struct ringbuf *buf, int sock) -{ - size_t to_read = ringbuf_space(buf); - size_t bytes_to_end = buf->size - buf->end; - ssize_t bytes_read; - struct iovec iov[2] = {}; - - /* Calculate amount of read blocks. */ - if (to_read > bytes_to_end) { - iov[0].iov_base = buf->data + buf->end; - iov[0].iov_len = bytes_to_end; - iov[1].iov_base = buf->data; - iov[1].iov_len = to_read - bytes_to_end; - } else { - iov[0].iov_base = buf->data + buf->end; - iov[0].iov_len = to_read; - } - - /* Do the system call. */ - bytes_read = readv(sock, iov, 2); - if (bytes_read <= 0) - return bytes_read; - - /* Calculate the new end. */ - if ((size_t)bytes_read > bytes_to_end) - buf->end = bytes_read - bytes_to_end; - else - buf->end += bytes_read; - - /* Set emptiness state. */ - buf->empty = (buf->start == buf->end) && (buf->empty && !bytes_read); - - return bytes_read; -} |
