… | |
… | |
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: packet.C,v 1.4 2007/08/28 17:08:12 pippijn Exp $"; |
8 | static char const rcsid[] = "$Id: packet.C,v 1.5 2007/08/30 19:56:26 pippijn Exp $"; |
9 | |
9 | |
10 | #include "atheme.h" |
10 | #include "atheme.h" |
11 | #include "uplink.h" |
11 | #include "uplink.h" |
12 | #include "datastream.h" |
12 | #include "datastream.h" |
|
|
13 | #include "connection.h" |
13 | |
14 | |
14 | static void on_connected (connection_t *cptr); |
15 | static void on_connected (connection_t *cptr); |
15 | |
16 | |
16 | /* bursting timer */ |
17 | /* bursting timer */ |
17 | #if HAVE_GETTIMEOFDAY |
18 | #if HAVE_GETTIMEOFDAY |
… | |
… | |
23 | { |
24 | { |
24 | bool wasnonl; |
25 | bool wasnonl; |
25 | char parsebuf[BUFSIZE + 1]; |
26 | char parsebuf[BUFSIZE + 1]; |
26 | int count; |
27 | int count; |
27 | |
28 | |
28 | wasnonl = cptr->flags & CF_NONEWLINE ? true : false; |
29 | wasnonl = cptr->flags & connection_t::CF_NONEWLINE ? true : false; |
29 | count = recvq_getline (cptr, parsebuf, sizeof parsebuf - 1); |
30 | count = recvq_getline (cptr, parsebuf, sizeof parsebuf - 1); |
30 | if (count <= 0) |
31 | if (count <= 0) |
31 | return; |
32 | return; |
32 | cnt.bin += count; |
33 | cnt.bin += count; |
33 | /* ignore the excessive part of a too long line */ |
34 | /* ignore the excessive part of a too long line */ |
… | |
… | |
59 | sts ("ERROR :Closing Link: 127.0.0.1 (Ping timeout: %d seconds)", diff); |
60 | sts ("ERROR :Closing Link: 127.0.0.1 (Ping timeout: %d seconds)", diff); |
60 | sendq_flush (curr_uplink->conn); |
61 | sendq_flush (curr_uplink->conn); |
61 | if (me.connected) |
62 | if (me.connected) |
62 | { |
63 | { |
63 | errno = 0; |
64 | errno = 0; |
64 | connection_close (curr_uplink->conn); |
65 | curr_uplink->conn->close (); |
65 | } |
66 | } |
66 | } |
67 | } |
67 | } |
68 | } |
68 | |
69 | |
69 | if (!me.connected) |
70 | if (!me.connected) |
… | |
… | |
75 | { |
76 | { |
76 | /* add our server */ |
77 | /* add our server */ |
77 | |
78 | |
78 | if (cptr == curr_uplink->conn) |
79 | if (cptr == curr_uplink->conn) |
79 | { |
80 | { |
80 | cptr->flags = CF_UPLINK; |
81 | cptr->flags = connection_t::CF_UPLINK; |
81 | cptr->recvq_handler = irc_recvq_handler; |
82 | cptr->recvq_handler = irc_recvq_handler; |
82 | me.connected = true; |
83 | me.connected = true; |
83 | /* no SERVER message received */ |
84 | /* no SERVER message received */ |
84 | me.recvsvr = false; |
85 | me.recvsvr = false; |
85 | |
86 | |