/*
- * $Id: asn.cc,v 1.27 1998/03/17 02:42:25 wessels Exp $
+ * $Id: asn.cc,v 1.28 1998/03/27 22:44:18 wessels Exp $
*
* DEBUG: section 53 AS Number handling
* AUTHOR: Duane Wessels, Kostas Anagnostakis
static int asnAddNet(char *, int);
static void asnCacheStart(int as);
static PF whoisClose;
+static PF whoisTimeout;
static CNCB whoisConnectDone;
static PF whoisReadReply;
static STCB asHandleReply;
snprintf(buf, 128, "%s\r\n", strBuf(p->request->urlpath) + 1);
debug(53, 3) ("whoisConnectDone: FD %d, '%s'\n", fd, strBuf(p->request->urlpath) + 1);
comm_write(fd, xstrdup(buf), strlen(buf), NULL, p, xfree);
- commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, Config.Timeout.read);
+ commSetSelect(fd, COMM_SELECT_READ, whoisReadReply, p, 0);
+ commSetTimeout(fd, Config.Timeout.read, whoisTimeout, p);
+}
+
+static void
+whoisTimeout(int fd, void *data)
+{
+ whoisState *p = data;
+ debug(53, 1) ("whoisTimeout: %s\n", storeUrl(p->entry));
+ whoisClose(fd, p);
}
static void
/*
- * $Id: ftp.cc,v 1.211 1998/03/27 19:41:58 wessels Exp $
+ * $Id: ftp.cc,v 1.212 1998/03/27 22:44:20 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
ftpState->data.buf = xmalloc(SQUID_TCP_SO_RCVBUF);
ftpState->data.size = SQUID_TCP_SO_RCVBUF;
ftpState->data.freefunc = xfree;
- commSetSelect(fd, COMM_SELECT_READ, ftpReadControlReply, ftpState, Config.Timeout.read);
+ commSetSelect(fd, COMM_SELECT_READ, ftpReadControlReply, ftpState, 0);
+ commSetTimeout(fd, Config.Timeout.read, ftpTimeout, ftpState);
}
}
/*
- * $Id: gopher.cc,v 1.123 1998/03/16 21:59:58 wessels Exp $
+ * $Id: gopher.cc,v 1.124 1998/03/27 22:44:21 wessels Exp $
*
* DEBUG: section 10 Gopher
* AUTHOR: Harvest Derived
comm_close(fd);
} else {
commSetSelect(fd, COMM_SELECT_WRITE, gopherSendRequest, gopherState, 0);
+ commSetTimeout(fd, Config.Timeout.read, gopherTimeout, gopherState);
}
}
/*
- * $Id: http.cc,v 1.257 1998/03/20 18:06:44 rousskov Exp $
+ * $Id: http.cc,v 1.258 1998/03/27 22:44:22 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
fd_note(fd, storeUrl(entry));
fd_table[fd].uses++;
commSetSelect(fd, COMM_SELECT_WRITE, httpSendRequest, httpState, 0);
+ commSetTimeout(fd, Config.Timeout.read, httpTimeout, httpState);
}
}
/*
- * $Id: ident.cc,v 1.38 1998/03/17 00:38:53 wessels Exp $
+ * $Id: ident.cc,v 1.39 1998/03/27 22:44:23 wessels Exp $
*
* DEBUG: section 30 Ident (RFC 931)
* AUTHOR: Duane Wessels
static PF identReadReply;
static PF identClose;
+static PF identTimeout;
static CNCB identConnectDone;
static void identCallback(ConnStateData * connState);
connState->ident.fd = -1;
}
+static void
+identTimeout(int fd, void *data)
+{
+ ConnStateData *connState = data;
+ debug(30,3)("identTimeout: FD %d, %s\n", fd,
+ inet_ntoa(connState->peer.sin_addr));
+ comm_close(fd);
+}
+
/* start a TCP connection to the peer host on port 113 */
void
identStart(int fd, ConnStateData * connState, IDCB * callback, void *data)
ntohs(connState->me.sin_port));
comm_write(fd, xstrdup(reqbuf), strlen(reqbuf), NULL, connState, xfree);
commSetSelect(fd, COMM_SELECT_READ, identReadReply, connState, 0);
+ commSetTimeout(fd, Config.Timeout.read, identTimeout, connState);
}
static void
/*
- * $Id: ssl.cc,v 1.75 1998/03/04 23:52:42 wessels Exp $
+ * $Id: ssl.cc,v 1.76 1998/03/27 22:44:25 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
commSetSelect(sslState->server.fd,
COMM_SELECT_READ,
sslReadServer,
- sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
+ sslState,
+ Config.Timeout.read);
} else {
sslClose(sslState);
}
sslState->server.offset = 0;
sslState->server.len = len;
/* extend server read timeout */
- commSetTimeout(sslState->server.fd, Config.Timeout.read, NULL, NULL);
commSetSelect(sslState->client.fd,
COMM_SELECT_WRITE,
sslWriteClient,
- sslState, 0);
+ sslState,
+ Config.Timeout.read);
}
}
commSetSelect(sslState->client.fd,
COMM_SELECT_READ,
sslReadClient,
- sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
+ sslState,
+ Config.Timeout.read);
} else {
/* still have more to write */
commSetSelect(sslState->server.fd,
commSetSelect(sslState->server.fd,
COMM_SELECT_READ,
sslReadServer,
- sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
+ sslState,
+ Config.Timeout.read);
} else {
/* still have more to write */
commSetSelect(sslState->client.fd,
xstrncpy(sslState->server.buf, conn_established, SQUID_TCP_SO_RCVBUF);
sslState->server.len = strlen(conn_established);
sslState->server.offset = 0;
- commSetTimeout(sslState->server.fd, Config.Timeout.read, NULL, NULL);
commSetSelect(sslState->client.fd,
COMM_SELECT_WRITE,
sslWriteClient,
sslProxyConnected(sslState->server.fd, sslState);
else
sslConnected(sslState->server.fd, sslState);
+ commSetTimeout(sslState->server.fd,
+ Config.Timeout.read,
+ sslTimeout,
+ sslState);
}
}
COMM_SELECT_WRITE,
sslWriteServer,
sslState, 0);
- commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
+ commSetTimeout(sslState->server.fd,
+ Config.Timeout.read,
+ sslTimeout,
+ sslState);
commSetSelect(sslState->server.fd,
COMM_SELECT_READ,
sslReadServer,
sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
}
static void
/*
- * $Id: tunnel.cc,v 1.75 1998/03/04 23:52:42 wessels Exp $
+ * $Id: tunnel.cc,v 1.76 1998/03/27 22:44:25 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
commSetSelect(sslState->server.fd,
COMM_SELECT_READ,
sslReadServer,
- sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
+ sslState,
+ Config.Timeout.read);
} else {
sslClose(sslState);
}
sslState->server.offset = 0;
sslState->server.len = len;
/* extend server read timeout */
- commSetTimeout(sslState->server.fd, Config.Timeout.read, NULL, NULL);
commSetSelect(sslState->client.fd,
COMM_SELECT_WRITE,
sslWriteClient,
- sslState, 0);
+ sslState,
+ Config.Timeout.read);
}
}
commSetSelect(sslState->client.fd,
COMM_SELECT_READ,
sslReadClient,
- sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
+ sslState,
+ Config.Timeout.read);
} else {
/* still have more to write */
commSetSelect(sslState->server.fd,
commSetSelect(sslState->server.fd,
COMM_SELECT_READ,
sslReadServer,
- sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
+ sslState,
+ Config.Timeout.read);
} else {
/* still have more to write */
commSetSelect(sslState->client.fd,
xstrncpy(sslState->server.buf, conn_established, SQUID_TCP_SO_RCVBUF);
sslState->server.len = strlen(conn_established);
sslState->server.offset = 0;
- commSetTimeout(sslState->server.fd, Config.Timeout.read, NULL, NULL);
commSetSelect(sslState->client.fd,
COMM_SELECT_WRITE,
sslWriteClient,
sslProxyConnected(sslState->server.fd, sslState);
else
sslConnected(sslState->server.fd, sslState);
+ commSetTimeout(sslState->server.fd,
+ Config.Timeout.read,
+ sslTimeout,
+ sslState);
}
}
COMM_SELECT_WRITE,
sslWriteServer,
sslState, 0);
- commSetTimeout(fd, Config.Timeout.read, NULL, NULL);
+ commSetTimeout(sslState->server.fd,
+ Config.Timeout.read,
+ sslTimeout,
+ sslState);
commSetSelect(sslState->server.fd,
COMM_SELECT_READ,
sslReadServer,
sslState, 0);
- commSetTimeout(sslState->server.fd,
- Config.Timeout.read,
- NULL,
- NULL);
}
static void
/*
- * $Id: wais.cc,v 1.103 1998/03/05 00:43:11 wessels Exp $
+ * $Id: wais.cc,v 1.104 1998/03/27 22:44:26 wessels Exp $
*
* DEBUG: section 24 WAIS Relay
* AUTHOR: Harvest Derived
comm_close(fd);
} else {
commSetSelect(fd, COMM_SELECT_WRITE, waisSendRequest, waisState, 0);
+ commSetTimeout(fd, Config.Timeout.read, waisTimeout, waisState);
}
}