aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-08-19 23:27:56 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-08-19 23:27:56 +0200
commit1b0093b973cfa0dc041522e5d4e6f576b2df642e (patch)
tree28a1b4154611d572d9d7139103e03242dfb58a50 /src
parente9b2bc19ae652a2907f247e621b2e4773bdd2aab (diff)
downloadslirp-1b0093b973cfa0dc041522e5d4e6f576b2df642e.zip
slirp-1b0093b973cfa0dc041522e5d4e6f576b2df642e.tar.gz
slirp-1b0093b973cfa0dc041522e5d4e6f576b2df642e.tar.bz2
sosendoob: better document what urgc is used for
Diffstat (limited to 'src')
-rw-r--r--src/socket.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/socket.c b/src/socket.c
index 81a499f..3fbb873 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -336,8 +336,8 @@ int sosendoob(struct socket *so)
DEBUG_ARG("so = %p", so);
DEBUG_ARG("sb->sb_cc = %d", sb->sb_cc);
- if (so->so_urgc > 2048)
- so->so_urgc = 2048; /* XXXX */
+ if (so->so_urgc > sizeof(buff))
+ so->so_urgc = sizeof(buff); /* XXXX */
if (sb->sb_rptr < sb->sb_wptr) {
/* We can send it directly */
@@ -349,7 +349,7 @@ int sosendoob(struct socket *so)
* we must copy all data to a linear buffer then
* send it all
*/
- uint32_t urgc = so->so_urgc;
+ uint32_t urgc = so->so_urgc; /* Amount of room left in buff */
int len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;
if (len > urgc) {
len = urgc;
@@ -357,6 +357,7 @@ int sosendoob(struct socket *so)
memcpy(buff, sb->sb_rptr, len);
urgc -= len;
if (urgc) {
+ /* We still have some room for the rest */
n = sb->sb_wptr - sb->sb_data;
if (n > urgc) {
n = urgc;