From 4e365cec5275e3dec782af3ec0bc9a651cc2b831 Mon Sep 17 00:00:00 2001 From: dequis Date: Sun, 25 Oct 2015 01:06:22 -0300 Subject: Add proxy_disconnect() to interrupt possibly pending connections Fixes trac ticket 1198, https://bugs.bitlbee.org/bitlbee/ticket/1198 This function can be used as a safe drop-in replacement to closesocket() If a proxy connection is pending (connected callback still not called), it looks up the PHB in a hash table indexed by fd. If it is there, it closes, frees the phb and avoids further calls to the callback. If it is not in there, it just does closesocket() --- lib/proxy.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/proxy.h') diff --git a/lib/proxy.h b/lib/proxy.h index eaf31375..3c1b019b 100644 --- a/lib/proxy.h +++ b/lib/proxy.h @@ -48,5 +48,6 @@ extern char proxyuser[128]; extern char proxypass[128]; G_MODULE_EXPORT int proxy_connect(const char *host, int port, b_event_handler func, gpointer data); +G_MODULE_EXPORT void proxy_disconnect(int fd); #endif /* _PROXY_H_ */ -- cgit v1.2.3