pespin has uploaded this change for review.

View Change

gsmtap_util: Set source_fd RCVBUF to minimum

We never expect to receive anything on this socket, so set its RCVBUF to
the minimum possible to save some memory.

Change-Id: If82b3edf11dea1a124035d4eb0e6aa44f4223555
---
M src/core/gsmtap_util.c
1 file changed, 6 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/15/41715/1
diff --git a/src/core/gsmtap_util.c b/src/core/gsmtap_util.c
index 3fab7ac..0a920e3 100644
--- a/src/core/gsmtap_util.c
+++ b/src/core/gsmtap_util.c
@@ -501,6 +501,7 @@
{
struct gsmtap_inst *gti;
int fd;
+ int buflen;

fd = gsmtap_source_init_fd2(local_host, local_port, rem_host, rem_port);
if (fd < 0)
@@ -522,6 +523,11 @@
osmo_iofd_set_txqueue_max_length(gti->out, 1024);
}

+ /* We never read from this socket, so tell the kernel
+ * to set the RCVBUF to the minimum possible value */
+ buflen = 0;
+ setsockopt(gti->source_fd, SOL_SOCKET, SO_RCVBUF, &buflen, sizeof(buflen));
+
return gti;

err_cleanup:

To view, visit change 41715. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If82b3edf11dea1a124035d4eb0e6aa44f4223555
Gerrit-Change-Number: 41715
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>