mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 20:33:46 +02:00
Added some magic to /SERVER - if there's no server to disconnect from
in active server, irssi checks if some reconnection should be used instead. If there's one reconnection, /SERVER always uses it. If there's reconnection to same host, it will be used (+same port is preferred) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@870 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
3fbd7d5c82
commit
532d6c1e9d
3 changed files with 69 additions and 11 deletions
|
|
@ -48,7 +48,7 @@ static void server_reconnect_add(SERVER_CONNECT_REC *conn,
|
|||
reconnects = g_slist_append(reconnects, rec);
|
||||
}
|
||||
|
||||
static void server_reconnect_destroy(RECONNECT_REC *rec, int free_conn)
|
||||
void server_reconnect_destroy(RECONNECT_REC *rec, int free_conn)
|
||||
{
|
||||
g_return_if_fail(rec != NULL);
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ static int server_reconnect_timeout(void)
|
|||
static void sserver_connect(SERVER_SETUP_REC *rec, SERVER_CONNECT_REC *conn)
|
||||
{
|
||||
conn->address = g_strdup(rec->address);
|
||||
conn->port = rec->port;
|
||||
if (conn->port == 0) conn->port = rec->port;
|
||||
|
||||
server_setup_fill_reconn(conn, rec);
|
||||
if (rec->last_connect > time(NULL)-reconnect_time) {
|
||||
|
|
@ -209,6 +209,8 @@ static void sig_reconnect(SERVER_REC *server)
|
|||
if (rec->chatnet != NULL && g_strcasecmp(conn->chatnet, rec->chatnet) == 0 &&
|
||||
!rec->banned && (!rec->last_connect || !rec->last_failed ||
|
||||
rec->last_connect < now-FAILED_RECONNECT_WAIT)) {
|
||||
if (rec == sserver)
|
||||
conn->port = server->connrec->port;
|
||||
sserver_connect(rec, conn);
|
||||
return;
|
||||
}
|
||||
|
|
@ -224,6 +226,8 @@ static void sig_reconnect(SERVER_REC *server)
|
|||
found = TRUE;
|
||||
else if (found && !rec->banned && rec->chatnet != NULL &&
|
||||
g_strcasecmp(conn->chatnet, rec->chatnet) == 0) {
|
||||
if (rec == sserver)
|
||||
conn->port = server->connrec->port;
|
||||
sserver_connect(rec, conn);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ typedef struct {
|
|||
|
||||
extern GSList *reconnects;
|
||||
|
||||
void server_reconnect_destroy(RECONNECT_REC *rec, int free_conn);
|
||||
|
||||
void servers_reconnect_init(void);
|
||||
void servers_reconnect_deinit(void);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue