Added setting to limit the SIP socket receiver buffer size.
git-svn-id: http://voip.null.ro/svn/yate@1292 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
fdd4693990
commit
870f99c7b5
|
@ -7,8 +7,11 @@
|
||||||
; addr: ipaddress: IP address to bind to
|
; addr: ipaddress: IP address to bind to
|
||||||
;addr=0.0.0.0
|
;addr=0.0.0.0
|
||||||
|
|
||||||
|
; buffer: int: Requested size of socket's receive buffer, 0 to use default
|
||||||
|
;buffer=0
|
||||||
|
|
||||||
; useragent: string: String to set in User-Agent or Server headers
|
; useragent: string: String to set in User-Agent or Server headers
|
||||||
;useragent=YATE/1.1.0
|
;useragent=YATE/1.2.0
|
||||||
|
|
||||||
; realm: string: Authentication realm to offer in authentication requests
|
; realm: string: Authentication realm to offer in authentication requests
|
||||||
;realm=Yate
|
;realm=Yate
|
||||||
|
|
|
@ -1180,6 +1180,25 @@ bool YateSIPEndPoint::Init()
|
||||||
Debug(&plugin,DebugGoOn,"Unable to allocate UDP socket");
|
Debug(&plugin,DebugGoOn,"Unable to allocate UDP socket");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SO_RCVBUF
|
||||||
|
int reqlen = s_cfg.getIntValue("general","buffer");
|
||||||
|
if (reqlen > 0) {
|
||||||
|
int buflen = reqlen;
|
||||||
|
if (buflen < 4096)
|
||||||
|
buflen = 4096;
|
||||||
|
if (m_sock->setOption(SOL_SOCKET,SO_RCVBUF,&buflen,sizeof(buflen))) {
|
||||||
|
buflen = 0;
|
||||||
|
socklen_t sz = sizeof(buflen);
|
||||||
|
if (m_sock->getOption(SOL_SOCKET,SO_RCVBUF,&buflen,&sz))
|
||||||
|
Debug(&plugin,DebugNote,"UDP buffer size is %d (requested %d)",buflen,reqlen);
|
||||||
|
else
|
||||||
|
Debug(&plugin,DebugWarn,"Could not get UDP buffer size (requested %d)",reqlen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Debug(&plugin,DebugWarn,"Could not set UDP buffer size %d",buflen);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SocketAddr addr(AF_INET);
|
SocketAddr addr(AF_INET);
|
||||||
addr.port(s_cfg.getIntValue("general","port",5060));
|
addr.port(s_cfg.getIntValue("general","port",5060));
|
||||||
|
|
Loading…
Reference in New Issue