monitor interface announces new peers.

This commit is contained in:
gardners 2012-05-18 20:20:18 +09:30
parent 990a8f3057
commit 3ea6d4f324
3 changed files with 18 additions and 2 deletions

View File

@ -619,6 +619,14 @@ int monitor_call_status(vomp_call_state *call)
return 0; return 0;
} }
int monitor_announce_peer(unsigned char *sid)
{
unsigned char msg[1024];
snprintf((char *)msg,1024,"\nnewpeer %s\n",overlay_render_sid(sid));
monitor_tell_clients(msg,strlen((char *)msg));
return 0;
}
int monitor_send_audio(vomp_call_state *call,overlay_mdp_frame *audio) int monitor_send_audio(vomp_call_state *call,overlay_mdp_frame *audio)
{ {
if (0) WHYF("Tell call monitor about audio for call %06x:%06x", if (0) WHYF("Tell call monitor about audio for call %06x:%06x",
@ -643,6 +651,13 @@ int monitor_send_audio(vomp_call_state *call,overlay_mdp_frame *audio)
&msg[msglen],sample_bytes); &msg[msglen],sample_bytes);
msglen+=sample_bytes; msglen+=sample_bytes;
monitor_tell_clients(msg,msglen);
return 0;
}
int monitor_tell_clients(unsigned char *msg,int msglen)
{
int i; int i;
for(i=0;i<monitor_socket_count;i++) for(i=0;i<monitor_socket_count;i++)
{ {
@ -671,7 +686,5 @@ int monitor_send_audio(vomp_call_state *call,overlay_mdp_frame *audio)
} }
} }
} }
return 0; return 0;
} }

View File

@ -502,6 +502,7 @@ overlay_node *overlay_route_find_node(unsigned char *sid,int prefixLen,int creat
/* Ask for newly discovered node to be advertised */ /* Ask for newly discovered node to be advertised */
overlay_route_please_advertise(&overlay_nodes[bin_number][slot]); overlay_route_please_advertise(&overlay_nodes[bin_number][slot]);
monitor_announce_peer(sid);
bcopy(sid,overlay_nodes[bin_number][free_slot].sid,SID_SIZE); bcopy(sid,overlay_nodes[bin_number][free_slot].sid,SID_SIZE);
return &overlay_nodes[bin_number][free_slot]; return &overlay_nodes[bin_number][free_slot];

View File

@ -1464,6 +1464,8 @@ int monitor_poll();
int monitor_get_fds(struct pollfd *fds,int *fdcount,int fdmax); int monitor_get_fds(struct pollfd *fds,int *fdcount,int fdmax);
int monitor_call_status(vomp_call_state *call); int monitor_call_status(vomp_call_state *call);
int monitor_send_audio(vomp_call_state *call,overlay_mdp_frame *audio); int monitor_send_audio(vomp_call_state *call,overlay_mdp_frame *audio);
int monitor_announce_peer(unsigned char *sid);
int monitor_tell_clients(unsigned char *msg,int msglen);
extern int monitor_socket_count; extern int monitor_socket_count;