Browse code

added maxbuffer configuratiion option

Jiri Kuthan authored on 12/11/2001 21:46:12
Showing 1 changed files
... ...
@@ -71,9 +71,10 @@ int udp_init(unsigned long ip, unsigned short port)
71 71
 			BUFFER_INCREMENT );
72 72
 		ioptval=BUFFER_INCREMENT;
73 73
 	} else LOG(L_INFO, "INFO: udp_init: SO_RCVBUF is initially %d\n", ioptval );
74
-	for (optval=ioptval; optval < MAX_RECV_BUFFER_SIZE ;  ) {
74
+	for (optval=ioptval; ;  ) {
75 75
 		/* increase size; double in initial phase, add linearly later */
76 76
 		if (phase==0) optval <<= 1; else optval+=BUFFER_INCREMENT;
77
+		if (optval > maxbuffer) if (phase==1) break; else { phase=1; optval >>=1; continue; }
77 78
 		LOG(L_DBG, "DEBUG: udp_init: trying SO_RCVBUF: %d\n", optval );
78 79
         	if (setsockopt( udp_sock, SOL_SOCKET, SO_RCVBUF,
79 80
                              (void*)&optval, sizeof(optval)) ==-1)