[AGENT++] AgentX subagent: connection lost when signal arrives
Rüdiger Hinze
ruediger.hinze at vit.vossloh.com
Mon Sep 19 12:31:00 CEST 2005
Hi,
I ran into a problem on Linux when using POSIX timers in an AgentX subagent:
every time a timer was released the connection to the master agent was lost.
The reason is that the select in AgentXSlave::receive doesn't handle
interrupts. For me, changing
if ((sel = select(FD_SETSIZE, &fdSet, NULL, NULL, tvptr)) < 0) {
LOG_BEGIN(ERROR_LOG | 1);
LOG("AgentXSlave: lost conncection with master");
LOG_END;
stopit = TRUE;
delete tvptr;
return 0;
}
else if (sel == 0) { ...
to
if ((sel = select(FD_SETSIZE, &fdSet, NULL, NULL, tvptr)) < 0) {
if (errno == EINTR) {
LOG_BEGIN(ERROR_LOG | 5);
LOG("AgentXSlave: select interrupted");
LOG_END;
delete tvptr;
return 0;
}
else
{
LOG_BEGIN(ERROR_LOG | 1);
LOG("AgentXSlave: lost conncection with master");
LOG_END;
stopit = TRUE;
delete tvptr;
return 0;
}
}
else if (sel == 0) { ...
solved the problem.
Regards,
Ruediger Hinze
More information about the AGENTPP
mailing list