Fix issue #23, regression in 'id' command

This commit is contained in:
Jeremy Lakeman 2012-10-08 14:59:25 +10:30
parent 164e9a7b87
commit c47e99d097
2 changed files with 5 additions and 3 deletions

View File

@ -1344,7 +1344,7 @@ int app_id_self(int argc, const char *const *argv, struct command_line_option *o
return WHYF("unsupported arg '%s'", argv[1]); return WHYF("unsupported arg '%s'", argv[1]);
a.addrlist.first_sid=0; a.addrlist.first_sid=0;
while(a.addrlist.frame_sid_count==MDP_MAX_SID_REQUEST) { do{
result=overlay_mdp_send(&a,MDP_AWAITREPLY,5000); result=overlay_mdp_send(&a,MDP_AWAITREPLY,5000);
if (result) { if (result) {
if (a.packetTypeAndFlags==MDP_ERROR) if (a.packetTypeAndFlags==MDP_ERROR)
@ -1366,7 +1366,8 @@ int app_id_self(int argc, const char *const *argv, struct command_line_option *o
/* get ready to ask for next block of SIDs */ /* get ready to ask for next block of SIDs */
a.packetTypeAndFlags=MDP_GETADDRS; a.packetTypeAndFlags=MDP_GETADDRS;
a.addrlist.first_sid=a.addrlist.last_sid+1; a.addrlist.first_sid=a.addrlist.last_sid+1;
} }while(a.addrlist.frame_sid_count==MDP_MAX_SID_REQUEST);
return 0; return 0;
} }

View File

@ -951,7 +951,7 @@ static int search_subscribers(struct subscriber *subscriber, void *context){
} }
if (response->server_sid_count++ >= response->first_sid && if (response->server_sid_count++ >= response->first_sid &&
response->first_sid + response->frame_sid_count < response->last_sid) { response->frame_sid_count < MDP_MAX_SID_REQUEST) {
memcpy(response->sids[response->frame_sid_count++], subscriber->sid, SID_SIZE); memcpy(response->sids[response->frame_sid_count++], subscriber->sid, SID_SIZE);
} }
@ -1026,6 +1026,7 @@ void overlay_mdp_poll(struct sched_ent *alarm)
case MDP_GETADDRS: case MDP_GETADDRS:
{ {
overlay_mdp_frame mdpreply; overlay_mdp_frame mdpreply;
bzero(&mdpreply, sizeof(overlay_mdp_frame));
mdpreply.packetTypeAndFlags = MDP_ADDRLIST; mdpreply.packetTypeAndFlags = MDP_ADDRLIST;
if (!overlay_mdp_address_list(&mdp->addrlist, &mdpreply.addrlist)) if (!overlay_mdp_address_list(&mdp->addrlist, &mdpreply.addrlist))
/* Send back to caller */ /* Send back to caller */