diff --git a/conf.d/ysipchan.conf.sample b/conf.d/ysipchan.conf.sample index 7c4b78e8..04a409d7 100644 --- a/conf.d/ysipchan.conf.sample +++ b/conf.d/ysipchan.conf.sample @@ -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 diff --git a/modules/ysipchan.cpp b/modules/ysipchan.cpp index e02e3b48..709c5c0f 100644 --- a/modules/ysipchan.cpp +++ b/modules/ysipchan.cpp @@ -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;