mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-06 19:19:16 +00:00
better handling of disconnections by monitor clients.
This commit is contained in:
parent
e71b2385e6
commit
6bc8f5643f
15
monitor.c
15
monitor.c
@ -227,8 +227,9 @@ int monitor_poll()
|
||||
bytes=-1;
|
||||
break;
|
||||
}
|
||||
errno=0;
|
||||
bytes=read(c->socket,&c->line[c->line_length],1);
|
||||
if (bytes==-1) {
|
||||
if (bytes<1) {
|
||||
switch(errno) {
|
||||
case EAGAIN: case EINTR:
|
||||
/* transient errors */
|
||||
@ -263,10 +264,11 @@ int monitor_poll()
|
||||
}
|
||||
break;
|
||||
case MONITOR_STATE_DATA:
|
||||
errno=0;
|
||||
bytes=read(c->socket,
|
||||
&c->buffer[c->data_offset],
|
||||
c->data_expected-c->data_offset);
|
||||
if (bytes==-1) {
|
||||
if (bytes<1) {
|
||||
switch(errno) {
|
||||
case EAGAIN: case EINTR:
|
||||
/* transient errors */
|
||||
@ -451,9 +453,13 @@ int monitor_process_data(int index)
|
||||
int monitor_call_status(vomp_call_state *call)
|
||||
{
|
||||
int i;
|
||||
WHYF("Tell call monitor about call %06x:%06x",
|
||||
call->local.session,call->remote.session);
|
||||
char msg[1024];
|
||||
int show=0;
|
||||
if (call->local.state>call->local.last_state) show=1;
|
||||
if (call->remote.state>call->remote.last_state) show=1;
|
||||
call->local.last_state=call->local.state;
|
||||
call->remote.last_state=call->remote.state;
|
||||
if (show) {
|
||||
snprintf(msg,1024,"CALLSTATUS:%06x:%06x:%d:%d\n",
|
||||
call->local.session,call->remote.session,
|
||||
call->local.state,call->remote.state);
|
||||
@ -483,6 +489,7 @@ int monitor_call_status(vomp_call_state *call)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user