never dequeue event for send_ping because it may remove it on error, use the ev_first instead; reset ev_next and ev_prev when a HOST_ENTRY is dequeued or removed because re-adding it relies these two to be NULL

pull/11/head
Boian Bonev 13 years ago
parent 7e09a0cabb
commit f403f37cbe

@ -1104,12 +1104,12 @@ void main_loop()
lt = timeval_diff( &current_time, &last_send_time );
if(lt < interval) goto wait_for_reply;
/* Dequeue the event */
h = ev_dequeue();
/* Send the ping */
/*printf("Sending ping after %d ms\n", lt/100); */
if(!send_ping(s, h)) goto wait_for_reply;
if(!send_ping(s, ev_first)) goto wait_for_reply;
/* Dequeue the event */
h = ev_dequeue();
/* Check what needs to be done next */
if(!loop_flag && !count_flag) {
@ -2768,6 +2768,7 @@ HOST_ENTRY *ev_dequeue()
}
dequeued = ev_first;
ev_remove(dequeued);
dequeued->ev_next=dequeued->ev_prev=NULL;
return dequeued;
}
@ -2791,6 +2792,7 @@ void ev_remove(HOST_ENTRY *h)
if(h->ev_next) {
h->ev_next->ev_prev = h->ev_prev;
}
h->ev_next=h->ev_prev=NULL;
}

Loading…
Cancel
Save