Don't unwatch if the file descriptor is already closed

This commit is contained in:
Jeremy Lakeman 2012-12-04 16:30:01 +10:30
parent 55cad42932
commit 33e44ed6be

View File

@ -982,8 +982,10 @@ static int rhizome_fetch_close(struct rhizome_fetch_slot *slot)
/* close socket and stop watching it */ /* close socket and stop watching it */
unschedule(&slot->alarm); unschedule(&slot->alarm);
unwatch(&slot->alarm); if (slot->alarm.poll.fd>=0){
close(slot->alarm.poll.fd); unwatch(&slot->alarm);
close(slot->alarm.poll.fd);
}
slot->alarm.poll.fd = -1; slot->alarm.poll.fd = -1;
slot->alarm.function=NULL; slot->alarm.function=NULL;