[multicat-devel] [Git][videolan/multicat][master] 5 commits: util.c: log failed attempts to set SO_RCVBUF size
Christophe Massiot (@cmassiot)
gitlab at videolan.org
Mon Jun 15 13:01:35 UTC 2026
Christophe Massiot pushed to branch master at VideoLAN / multicat
Commits:
65f01f92 by igutidze at 2025-12-18T19:43:43+04:00
util.c: log failed attempts to set SO_RCVBUF size
- - - - -
35571cae by igutidze at 2025-12-18T21:10:11+04:00
util.c: make sure requested SO_RCVBUF is applied
- - - - -
9509ed15 by igutidze at 2025-12-18T21:13:44+04:00
util.c: add rcvbufsz command line option
- - - - -
75d14c91 by igutidze at 2025-12-18T21:17:09+04:00
Update README
- - - - -
4a7e200f by Christophe Massiot at 2026-06-15T15:01:21+02:00
Merge branch 'igutidze-igutidze-patch-10'
- - - - -
2 changed files:
- README
- util.c
Changes:
=====================================
README
=====================================
@@ -76,6 +76,7 @@ Options include:
/tcp (binds a TCP socket instead of UDP)
/srcaddr=XXX.XXX.XXX.XXX (source address for raw packets)
/srcportr=XX (source port for raw packets)
+ /rcvbufsz=XX (UDP receive buffer size)
Example:
239.255.0.1:5004/ttl=64
=====================================
util.c
=====================================
@@ -558,6 +558,7 @@ int OpenSocketSafe( const char *_psz_arg, int i_ttl, uint16_t i_bind_port,
in_addr_t i_raw_srcaddr = INADDR_ANY;
int i_raw_srcport = 0;
char *psz_ifname = NULL;
+ int i_rcvbufsz = 0x80000;
#ifdef __FreeBSD__
int hincl = 1;
#endif
@@ -681,6 +682,8 @@ int OpenSocketSafe( const char *_psz_arg, int i_ttl, uint16_t i_bind_port,
i_raw_srcport = strtol( ARG_OPTION("srcport="), NULL, 0 );
else if ( IS_OPTION("fd=") )
i_fd = strtol( ARG_OPTION("fd="), NULL, 0 );
+ else if ( IS_OPTION("rcvbufsz=") )
+ i_rcvbufsz = strtol( ARG_OPTION("rcvbufsz="), NULL, 0 );
else
msg_Warn( NULL, "unrecognized option %s", psz_token2 );
@@ -827,10 +830,25 @@ normal_bind:
if ( !*pb_tcp )
{
- /* Increase the receive buffer size to 1/2MB (8Mb/s during 1/2s) to
- * avoid packet loss caused by scheduling problems */
- i = 0x80000;
- setsockopt( i_fd, SOL_SOCKET, SO_RCVBUF, (void *) &i, sizeof( i ) );
+ /* Increase the receive buffer size to avoid packet loss caused by scheduling
+ * problems */
+ i = i_rcvbufsz;
+ if ( setsockopt( i_fd, SOL_SOCKET, SO_RCVBUF, (void *) &i, sizeof( i ) ) < 0 )
+ {
+ msg_Err( NULL, "couldn't adjust socket receive buffer size to %d (%s)",
+ i_rcvbufsz, strerror(errno) );
+ }
+ size_t len = sizeof(i);
+ if ( getsockopt( i_fd, SOL_SOCKET, SO_RCVBUF, (void *) &i, (void *) &len ) < 0 )
+ {
+ msg_Err( NULL, "couldn't retrieve socket receive buffer size (%s)",
+ strerror(errno) );
+ } else {
+ /* setsockopt doubles requested value, getsockopt returns the doubled value */
+ if ( i / 2 < i_rcvbufsz )
+ msg_Err( NULL, "tried to adjust receive buffer to %d but ended up with %d",
+ i_rcvbufsz, i / 2);
+ }
/* Join the multicast group if the socket is a multicast address */
if ( bind_addr.ss.ss_family == AF_INET
View it on GitLab: https://code.videolan.org/videolan/multicat/-/compare/ba2e48d91edafe1a64ba1c72eb3f2232b9d0e54c...4a7e200f06e972038a0b5604197b5002d5fab80b
--
View it on GitLab: https://code.videolan.org/videolan/multicat/-/compare/ba2e48d91edafe1a64ba1c72eb3f2232b9d0e54c...4a7e200f06e972038a0b5604197b5002d5fab80b
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the multicat-devel
mailing list