htcpOutSocket = htcpInSocket;
}
}
+
+/*
+ * htcpSocketShutdown only closes the 'in' socket if it is
+ * different than the 'out' socket.
+ */
+void
+htcpSocketShutdown(void)
+{
+ if (htcpInSocket < 0)
+ return;
+ if (htcpInSocket != htcpOutSocket) {
+ debug(12, 1) ("FD %d Closing HTCP socket\n", htcpInSocket);
+ comm_close(htcpInSocket);
+ }
+ /*
+ * Here we set 'htcpInSocket' to -1 even though the HTCP 'in'
+ * and 'out' sockets might be just one FD. This prevents this
+ * function from executing repeatedly. When we are really ready to
+ * exit or restart, main will comm_close the 'out' descriptor.
+ */
+ htcpInSocket = -1;
+ /*
+ * Normally we only write to the outgoing HTCP socket, but
+ * we also have a read handler there to catch messages sent
+ * to that specific interface. During shutdown, we must
+ * disable reading on the outgoing socket.
+ */
+ assert(htcpOutSocket > -1);
+ commSetSelect(htcpOutSocket, COMM_SELECT_READ, NULL, NULL, 0);
+}
+
+void
+htcpSocketClose(void)
+{
+ htcpSocketShutdown();
+ if (htcpOutSocket > -1) {
+ debug(12, 1) ("FD %d Closing HTCP socket\n", htcpOutSocket);
+ comm_close(htcpOutSocket);
+ }
+}
/*
- * $Id: main.cc,v 1.240 1998/03/31 04:09:51 wessels Exp $
+ * $Id: main.cc,v 1.241 1998/03/31 04:45:24 wessels Exp $
*
* DEBUG: section 1 Startup and Main Loop
* AUTHOR: Harvest Derived
*/
clientHttpConnectionsClose();
icpConnectionShutdown();
+#if USE_HTCP
+ htcpSocketShutdown();
+#endif
icmpClose();
#ifdef SQUID_SNMP
snmpConnectionShutdown();
/* Already called serverConnectionsClose and ipcacheShutdownServers() */
serverConnectionsClose();
icpConnectionClose();
+#if USE_HTCP
+ htcpSocketClose();
+#endif
#ifdef SQUID_SNMP
snmpConnectionClose();
#endif
case COMM_SHUTDOWN:
/* delayed close so we can transmit while shutdown pending */
icpConnectionClose();
+#if USE_HTCP
+ htcpSocketClose();
+#endif
#ifdef SQUID_SNMP
snmpConnectionClose();
#endif
extern void memBufReport(MemBuf * mb);
extern char *mime_get_header(const char *mime, const char *header);
+#if OLD_CODE
extern char *mime_headers_end(const char *mime);
+#endif
+extern size_t headersEnd(const char *, size_t);
extern int mk_mime_hdr(char *result, const char *type, int size, time_t ttl, time_t lmt);
extern const char *mime_get_auth(const char *hdr, const char *auth_scheme, const char **auth_field);
#if USE_HTCP
extern void htcpInit(void);
extern void htcpQuery(StoreEntry * e, request_t * req, peer * p);
+void htcpSocketShutdown(void);
+void htcpSocketClose(void);
#endif
/* String */