-/**/
+/*
+ * event.c
+ * - event loop core
+ * - TCP connection management
+ * - user-visible check/wait and event-loop-related functions
+ */
+/*
+ * This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
#include <string.h>
#include <errno.h>
qu->tcpfailed |= (1<<serv);
if (qu->tcpfailed == (1<<ads->nservers)-1) {
LIST_UNLINK(ads->timew,qu);
- adns__query_fail(ads,qu,adns_s_allservfail);
+ adns__query_fail(qu,adns_s_allservfail);
}
}
nqu= qu->next;
if (qu->state == query_udp) continue;
assert (qu->state == query_tcpwait);
- adns__query_tcp(ads,qu,now);
+ adns__query_tcp(qu,now);
}
}
} else {
if (timercmp(rbuf,&maxto,>)) *rbuf= maxto;
}
-fprintf(stderr,"inter_maxto maxto=%ld.%06ld result=%ld.%06ld\n",
- maxto.tv_sec,maxto.tv_usec,(**tv_io).tv_sec,(**tv_io).tv_usec);
+/*fprintf(stderr,"inter_maxto maxto=%ld.%06ld result=%ld.%06ld\n",
+ maxto.tv_sec,maxto.tv_usec,(**tv_io).tv_sec,(**tv_io).tv_usec);*/
}
static void inter_maxtoabs(struct timeval **tv_io, struct timeval *tvbuf,
struct timeval now, struct timeval maxtime) {
ldiv_t dr;
-fprintf(stderr,"inter_maxtoabs now=%ld.%06ld maxtime=%ld.%06ld\n",
- now.tv_sec,now.tv_usec,maxtime.tv_sec,maxtime.tv_usec);
+/*fprintf(stderr,"inter_maxtoabs now=%ld.%06ld maxtime=%ld.%06ld\n",
+ now.tv_sec,now.tv_usec,maxtime.tv_sec,maxtime.tv_usec);*/
if (!tv_io) return;
maxtime.tv_sec -= (now.tv_sec+2);
maxtime.tv_usec -= (now.tv_usec-2000000);
if (timercmp(&now,&qu->timeout,>)) {
LIST_UNLINK(ads->timew,qu);
if (qu->state != query_udp) {
- adns__query_fail(ads,qu,adns_s_timeout);
+ adns__query_fail(qu,adns_s_timeout);
} else {
- adns__query_udp(ads,qu,now);
+ adns__query_udp(qu,now);
}
} else {
inter_maxtoabs(tv_io,tvbuf,now,qu->timeout);
struct timeval tvto_lr;
int r;
-fprintf(stderr,"adns_interest\n");
+/*fprintf(stderr,"adns_interest\n");*/
-r= gettimeofday(&now,0);
+ r= gettimeofday(&now,0);
if (r) {
adns__warn(ads,-1,0,"gettimeofday failed - will sleep for a bit: %s",
strerror(errno));