Added thread priority setting for the SIP module.

git-svn-id: http://voip.null.ro/svn/yate@3753 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2010-10-25 13:13:35 +00:00
parent d0781c9d21
commit e8f806c950
2 changed files with 13 additions and 5 deletions

View File

@ -13,6 +13,12 @@
; buffer: int: Requested size of socket's receive buffer, 0 to use default
;buffer=0
; thread: keyword: Default priority of the SIP handling threads
; Can be one of: lowest, low, normal, high, highest
; High priorities need superuser privileges on POSIX operating systems
; Low priorities are not recommended except for debugging
;thread=normal
; floodevents: int: How many SIP events retrieved in a row trigger flood warning
;floodevents=20

View File

@ -182,7 +182,7 @@ private:
class YateSIPEndPoint : public Thread
{
public:
YateSIPEndPoint();
YateSIPEndPoint(Thread::Priority prio = Thread::Normal);
~YateSIPEndPoint();
bool Init(void);
void run(void);
@ -994,10 +994,12 @@ bool YateSIPEngine::checkUser(const String& username, const String& realm, const
return (res == response) && copyAuthParams(params,m);
}
YateSIPEndPoint::YateSIPEndPoint()
: Thread("YSIP EndPoint"), m_sock(0), m_engine(0)
YateSIPEndPoint::YateSIPEndPoint(Thread::Priority prio)
: Thread("YSIP EndPoint",prio),
m_sock(0), m_engine(0)
{
Debug(&plugin,DebugAll,"YateSIPEndPoint::YateSIPEndPoint() [%p]",this);
Debug(&plugin,DebugAll,"YateSIPEndPoint::YateSIPEndPoint(%s) [%p]",
Thread::priority(prio),this);
}
YateSIPEndPoint::~YateSIPEndPoint()
@ -4192,7 +4194,7 @@ void SIPDriver::initialize()
s_1xx_formats = s_cfg.getBoolValue("hacks","1xx_change_formats",true);
m_parser.initialize(s_cfg.getSection("codecs"),s_cfg.getSection("hacks"),s_cfg.getSection("general"));
if (!m_endpoint) {
m_endpoint = new YateSIPEndPoint();
m_endpoint = new YateSIPEndPoint(Thread::priority(s_cfg.getValue("general","thread")));
if (!(m_endpoint->Init())) {
delete m_endpoint;
m_endpoint = 0;