… | |
… | |
3 | * Rights to this code are documented in doc/pod/license.pod. |
3 | * Rights to this code are documented in doc/pod/license.pod. |
4 | * |
4 | * |
5 | * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) |
5 | * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) |
6 | */ |
6 | */ |
7 | |
7 | |
8 | static char const rcsid[] = "$Id: uplink.C,v 1.5 2007/08/30 06:57:25 pippijn Exp $"; |
8 | static char const rcsid[] = "$Id: uplink.C,v 1.6 2007/08/30 19:56:26 pippijn Exp $"; |
9 | |
9 | |
10 | #include <boost/foreach.hpp> |
10 | #include <boost/foreach.hpp> |
11 | |
11 | |
12 | #include "atheme.h" |
12 | #include "atheme.h" |
13 | #include "datastream.h" |
13 | #include "datastream.h" |
14 | #include "uplink.h" |
14 | #include "uplink.h" |
|
|
15 | #include "connection.h" |
15 | |
16 | |
16 | list_t uplinks; |
17 | list_t uplinks; |
17 | uplink_t *curr_uplink; |
18 | uplink_t *curr_uplink; |
18 | |
19 | |
19 | static void uplink_close (connection_t *cptr); |
20 | static void uplink_close (connection_t *cptr); |
… | |
… | |
132 | slog (LG_INFO, "uplink_connect(): trying again first entry %s[%s]:%d", curr_uplink->name, curr_uplink->host, curr_uplink->port); |
133 | slog (LG_INFO, "uplink_connect(): trying again first entry %s[%s]:%d", curr_uplink->name, curr_uplink->host, curr_uplink->port); |
133 | } |
134 | } |
134 | |
135 | |
135 | u = curr_uplink; |
136 | u = curr_uplink; |
136 | |
137 | |
137 | curr_uplink->conn = connection_open_tcp (u->host, u->vhost, u->port, recvq_put, sendq_flush); |
138 | curr_uplink->conn = connection_t::open_tcp (u->host, u->vhost, u->port, recvq_put, sendq_flush); |
138 | if (curr_uplink->conn != NULL) |
139 | if (curr_uplink->conn != NULL) |
139 | curr_uplink->conn->close_handler = uplink_close; |
140 | curr_uplink->conn->close_handler = uplink_close; |
140 | else |
141 | else |
141 | event_add_once ("reconn", reconn, NULL, me.recontime); |
142 | event_add_once ("reconn", reconn, NULL, me.recontime); |
142 | } |
143 | } |