mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Don't crash if /SET irssiproxy_ports is changed while having connected
clients git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2908 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
886c92e141
commit
6019a5cd15
@ -42,6 +42,7 @@ static void remove_client(CLIENT_REC *rec)
|
|||||||
g_return_if_fail(rec != NULL);
|
g_return_if_fail(rec != NULL);
|
||||||
|
|
||||||
proxy_clients = g_slist_remove(proxy_clients, rec);
|
proxy_clients = g_slist_remove(proxy_clients, rec);
|
||||||
|
rec->listen->clients = g_slist_remove(rec->listen->clients, rec);
|
||||||
|
|
||||||
if (ctcp_client == rec)
|
if (ctcp_client == rec)
|
||||||
ctcp_client = NULL;
|
ctcp_client = NULL;
|
||||||
@ -337,7 +338,8 @@ static void sig_listen(LISTEN_REC *listen)
|
|||||||
rec->tag = g_input_add(handle, G_INPUT_READ,
|
rec->tag = g_input_add(handle, G_INPUT_READ,
|
||||||
(GInputFunction) sig_listen_client, rec);
|
(GInputFunction) sig_listen_client, rec);
|
||||||
|
|
||||||
proxy_clients = g_slist_append(proxy_clients, rec);
|
proxy_clients = g_slist_prepend(proxy_clients, rec);
|
||||||
|
rec->listen->clients = g_slist_prepend(rec->listen->clients, rec);
|
||||||
|
|
||||||
signal_emit("proxy client connected", 1, rec);
|
signal_emit("proxy client connected", 1, rec);
|
||||||
printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
|
||||||
@ -583,6 +585,9 @@ static void remove_listen(LISTEN_REC *rec)
|
|||||||
{
|
{
|
||||||
proxy_listens = g_slist_remove(proxy_listens, rec);
|
proxy_listens = g_slist_remove(proxy_listens, rec);
|
||||||
|
|
||||||
|
while (rec->clients != NULL)
|
||||||
|
remove_client(rec->clients->data);
|
||||||
|
|
||||||
net_disconnect(rec->handle);
|
net_disconnect(rec->handle);
|
||||||
g_source_remove(rec->tag);
|
g_source_remove(rec->tag);
|
||||||
g_free(rec->ircnet);
|
g_free(rec->ircnet);
|
||||||
@ -644,8 +649,6 @@ void proxy_listen_init(void)
|
|||||||
|
|
||||||
void proxy_listen_deinit(void)
|
void proxy_listen_deinit(void)
|
||||||
{
|
{
|
||||||
while (proxy_clients != NULL)
|
|
||||||
remove_client(proxy_clients->data);
|
|
||||||
while (proxy_listens != NULL)
|
while (proxy_listens != NULL)
|
||||||
remove_listen(proxy_listens->data);
|
remove_listen(proxy_listens->data);
|
||||||
g_string_free(next_line, TRUE);
|
g_string_free(next_line, TRUE);
|
||||||
|
@ -13,6 +13,8 @@ typedef struct {
|
|||||||
|
|
||||||
int tag;
|
int tag;
|
||||||
GIOChannel *handle;
|
GIOChannel *handle;
|
||||||
|
|
||||||
|
GSList *clients;
|
||||||
} LISTEN_REC;
|
} LISTEN_REC;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user