rem: } else { phase=1; optval >>=1; continue; }
add: else { phase=1; optval >>=1; continue; } }
context: int probe_max_receive_buffer( int udp_sock ){	int optval;	int ioptval;	unsigned int ioptvallen;	int foptval;	unsigned int foptvallen;	int voptval;	unsigned int voptvallen;	int phase=0;	/* jku: try to increase buffer size as much as we can */	ioptvallen=sizeof(ioptval);	if (getsockopt( udp_sock, SOL_SOCKET, SO_RCVBUF, (void*) &ioptval,		    &ioptvallen) == -1 )	{		LOG(L_ERR, "ERROR: udp_init: getsockopt: %s\n", strerror(errno));		return -1;	}	if ( ioptval==0 ) 	{		LOG(L_DBG, "DEBUG: udp_init: SO_RCVBUF initialy set to 0; resetting to %d\n",			BUFFER_INCREMENT );		ioptval=BUFFER_INCREMENT;	} else LOG(L_INFO, "INFO: udp_init: SO_RCVBUF is initially %d\n", ioptval );	for (optval=ioptval; ;  ) {		/* increase size; double in initial phase, add linearly later */		if (phase==0) optval <<= 1; else optval+=BUFFER_INCREMENT;		if (optval > maxbuffer){			if (phase==1) break; 		} else { phase=1; optval >>=1; continue; }		LOG(L_DBG, "DEBUG: udp_init: trying SO_RCVBUF: %d\n", optval );		if (setsockopt( udp_sock, SOL_SOCKET, SO_RCVBUF,			(void*)&optval, sizeof(optval)) ==-1){			/* Solaris returns -1 if asked size too big; Linux ignores */			LOG(L_DBG, "DEBUG: udp_init: SOL_SOCKET failed"					" for %d, phase %d: %s\n", optval, phase, strerror(errno));			/* if setting buffer size failed and still in the aggressive			   phase, try less agressively; otherwise give up 			*/			if (phase==0) { phase=1; optval >>=1 ; continue; } 			else break;		} 		/* verify if change has taken effect */		/* Linux note -- otherwise I would never know that; funny thing: Linux		   doubles size for which we asked in setsockopt		*/		voptvallen=sizeof(voptval);		if (getsockopt( udp_sock, SOL_SOCKET, SO_RCVBUF, (void*) &voptval,		    &voptvallen) == -1 )		{			LOG(L_ERR, "ERROR: udp_init: getsockopt: %s\n", strerror(errno));			return -1;		} else {			LOG(L_DBG, "DEBUG: setting SO_RCVBUF; set=%d,verify=%d\n", 				optval, voptval);			if (voptval<optval) {				LOG(L_DBG, "DEBUG: setting SO_RCVBUF has no effect\n");				/* if setting buffer size failed and still in the aggressive				phase, try less agressively; otherwise give up 				*/				if (phase==0) { phase=1; optval >>=1 ; continue; } 				else break;			} 		}		} /* for ... */	foptvallen=sizeof(foptval);	if (getsockopt( udp_sock, SOL_SOCKET, SO_RCVBUF, (void*) &foptval,		    &foptvallen) == -1 )	{		LOG(L_ERR, "ERROR: udp_init: getsockopt: %s\n", strerror(errno));		return -1;	}	LOG(L_INFO, "INFO: udp_init: SO_RCVBUF is finally %d\n", foptval );	return 0;	/* EoJKU */}