*** empty log message ***
git-svn-id: http://voip.null.ro/svn/yate@306 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
2b83f78f32
commit
31d8311e8f
|
@ -76,7 +76,8 @@ using namespace TelEngine;
|
|||
#define DLL_SUFFIX ".yate"
|
||||
#define CFG_SUFFIX ".conf"
|
||||
|
||||
#define MAX_SANITY 8
|
||||
#define MAX_SANITY 5
|
||||
#define INIT_SANITY 10
|
||||
|
||||
static u_int64_t s_nextinit = 0;
|
||||
static u_int64_t s_restarts = 0;
|
||||
|
@ -322,6 +323,7 @@ int Engine::run()
|
|||
s_haltcode &= 0xff;
|
||||
Output("Yate engine is shutting down with code %d",s_haltcode);
|
||||
dispatch("engine.halt");
|
||||
Thread::msleep(200);
|
||||
m_dispatcher.dequeue();
|
||||
Thread::killall();
|
||||
m_dispatcher.dequeue();
|
||||
|
@ -568,7 +570,7 @@ static int supervise(void)
|
|||
}
|
||||
::close(wdogfd[1]);
|
||||
// Wait for the child to die or block
|
||||
for (int sanity = MAX_SANITY; sanity > 0; sanity--) {
|
||||
for (int sanity = INIT_SANITY; sanity > 0; sanity--) {
|
||||
int status = -1;
|
||||
int tmp = ::waitpid(s_childpid,&status,WNOHANG);
|
||||
if (tmp > 0) {
|
||||
|
|
|
@ -182,7 +182,7 @@ int Message::commonDecode(const char* str, int offs)
|
|||
}
|
||||
|
||||
MessageHandler::MessageHandler(const char* name, unsigned priority)
|
||||
: String(name), m_priority(priority), m_dispatcher(0)
|
||||
: String(name), m_priority(priority), m_dispatcher(0), m_filter(0)
|
||||
{
|
||||
XDebug(DebugAll,"MessageHandler::MessageHandler(\"%s\",%u) [%p]",name,priority,this);
|
||||
}
|
||||
|
@ -192,6 +192,22 @@ MessageHandler::~MessageHandler()
|
|||
XDebug(DebugAll,"MessageHandler::~MessageHandler() [%p]",this);
|
||||
if (m_dispatcher)
|
||||
m_dispatcher->uninstall(this);
|
||||
clearFilter();
|
||||
}
|
||||
|
||||
void MessageHandler::setFilter(NamedString* filter)
|
||||
{
|
||||
clearFilter();
|
||||
m_filter = filter;
|
||||
}
|
||||
|
||||
void MessageHandler::clearFilter()
|
||||
{
|
||||
if (m_filter) {
|
||||
NamedString* tmp = m_filter;
|
||||
m_filter = 0;
|
||||
delete tmp;
|
||||
}
|
||||
}
|
||||
|
||||
MessageDispatcher::MessageDispatcher()
|
||||
|
@ -265,6 +281,8 @@ bool MessageDispatcher::dispatch(Message& msg)
|
|||
for (; l; l=l->next()) {
|
||||
MessageHandler *h = static_cast<MessageHandler*>(l->get());
|
||||
if (h && (h->null() || *h == msg)) {
|
||||
if (h->filter() && (*(h->filter()) != msg.getValue(h->filter()->name())))
|
||||
continue;
|
||||
unsigned int c = m_changes;
|
||||
unsigned int p = h->priority();
|
||||
m_mutex.unlock();
|
||||
|
|
27
yatengine.h
27
yatengine.h
|
@ -345,9 +345,36 @@ public:
|
|||
inline unsigned priority() const
|
||||
{ return m_priority; }
|
||||
|
||||
/**
|
||||
* Retrive the filter (if installed) associated to this handler
|
||||
*/
|
||||
inline const NamedString* filter() const
|
||||
{ return m_filter; }
|
||||
|
||||
/**
|
||||
* Set a filter for this handler
|
||||
* @param filter Pointer to the filter to install, will be owned and
|
||||
* destroyed by the handler
|
||||
*/
|
||||
void setFilter(NamedString* filter);
|
||||
|
||||
/**
|
||||
* Set a filter for this handler
|
||||
* @param name Name of the parameter to filter
|
||||
* @param value Value of the parameter to filter
|
||||
*/
|
||||
inline void setFilter(const char* name, const char* value)
|
||||
{ setFilter(new NamedString(name,value)); }
|
||||
|
||||
/**
|
||||
* Remove and destroy any filter associated to this handler
|
||||
*/
|
||||
void clearFilter();
|
||||
|
||||
private:
|
||||
unsigned m_priority;
|
||||
MessageDispatcher* m_dispatcher;
|
||||
NamedString* m_filter;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue