Mercurial > pidgin
annotate libfaim/aim_conn.c @ 889:e1da6a6ec42b
[gaim-migrate @ 899]
Oscar works again
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 12 Sep 2000 20:21:36 +0000 |
parents | 595ac7759563 |
children | 5e6ca3dd4d02 |
rev | line source |
---|---|
2 | 1 |
2 /* | |
3 * aim_conn.c | |
4 * | |
5 * Does all this gloriously nifty connection handling stuff... | |
6 * | |
7 */ | |
8 | |
283
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
9 #include <faim/aim.h> |
2 | 10 |
889
e1da6a6ec42b
[gaim-migrate @ 899]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
11 #ifndef _WIN32 |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
12 #include <netdb.h> |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
13 #include <sys/socket.h> |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
14 #include <netinet/in.h> |
889
e1da6a6ec42b
[gaim-migrate @ 899]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
15 #endif |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
16 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
17 /* |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
18 * Clears out connection list, killing remaining connections. |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
19 */ |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
20 faim_internal void aim_connrst(struct aim_session_t *sess) |
2 | 21 { |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
711
diff
changeset
|
22 faim_mutex_init(&sess->connlistlock); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
23 if (sess->connlist) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
24 struct aim_conn_t *cur = sess->connlist, *tmp; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
25 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
26 while(cur) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
27 tmp = cur->next; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
28 aim_conn_close(cur); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
29 free(cur); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
30 cur = tmp; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
31 } |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
32 } |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
33 sess->connlist = NULL; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
34 return; |
2 | 35 } |
36 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
37 /* |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
38 * Gets a new connection structure. |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
39 */ |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
40 faim_internal struct aim_conn_t *aim_conn_getnext(struct aim_session_t *sess) |
2 | 41 { |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
42 struct aim_conn_t *newconn, *cur; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
43 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
44 if (!(newconn = malloc(sizeof(struct aim_conn_t)))) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
45 return NULL; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
46 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
47 memset(newconn, 0, sizeof(struct aim_conn_t)); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
48 aim_conn_close(newconn); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
49 newconn->next = NULL; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
50 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
51 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
52 if (sess->connlist == NULL) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
53 sess->connlist = newconn; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
54 else { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
55 for (cur = sess->connlist; cur->next; cur = cur->next) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
56 ; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
57 cur->next = newconn; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
58 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
59 faim_mutex_unlock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
60 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
61 return newconn; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
62 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
63 |
638
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
64 static void aim_conn_init(struct aim_conn_t *deadconn) |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
65 { |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
66 if (!deadconn) |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
67 return; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
68 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
69 deadconn->fd = -1; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
70 deadconn->subtype = -1; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
71 deadconn->type = -1; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
72 deadconn->seqnum = 0; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
73 deadconn->lastactivity = 0; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
74 deadconn->forcedlatency = 0; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
75 deadconn->handlerlist = NULL; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
76 deadconn->priv = NULL; |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
711
diff
changeset
|
77 faim_mutex_init(&deadconn->active); |
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
711
diff
changeset
|
78 faim_mutex_init(&deadconn->seqnum_lock); |
638
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
79 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
80 return; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
81 } |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
82 |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
83 faim_export void aim_conn_kill(struct aim_session_t *sess, struct aim_conn_t **deadconn) |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
84 { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
85 struct aim_conn_t *cur; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
86 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
87 if (!deadconn || !*deadconn) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
88 return; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
89 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
90 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
91 if (sess->connlist == NULL) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
92 ; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
93 else if (sess->connlist->next == NULL) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
94 if (sess->connlist == *deadconn) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
95 sess->connlist = NULL; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
96 } else { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
97 cur = sess->connlist; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
98 while (cur->next) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
99 if (cur->next == *deadconn) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
100 cur->next = cur->next->next; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
101 break; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
102 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
103 cur = cur->next; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
104 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
105 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
106 faim_mutex_unlock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
107 |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
108 /* XXX: do we need this for txqueue too? */ |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
109 aim_rxqueue_cleanbyconn(sess, *deadconn); |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
110 |
711
b967d21d7482
[gaim-migrate @ 721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
707
diff
changeset
|
111 aim_conn_close(*deadconn); |
b967d21d7482
[gaim-migrate @ 721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
707
diff
changeset
|
112 if ((*deadconn)->priv) |
b967d21d7482
[gaim-migrate @ 721]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
707
diff
changeset
|
113 free((*deadconn)->priv); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
114 free(*deadconn); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
115 deadconn = NULL; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
116 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
117 return; |
2 | 118 } |
119 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
120 faim_export void aim_conn_close(struct aim_conn_t *deadconn) |
2 | 121 { |
638
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
122 int typesav = -1, subtypesav = -1; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
123 void *privsav = NULL; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
124 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
125 faim_mutex_destroy(&deadconn->active); |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
126 faim_mutex_destroy(&deadconn->seqnum_lock); |
2 | 127 if (deadconn->fd >= 3) |
128 close(deadconn->fd); | |
283
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
129 if (deadconn->handlerlist) |
0f14e6d8a51b
[gaim-migrate @ 293]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
281
diff
changeset
|
130 aim_clearhandlers(deadconn); |
638
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
131 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
132 typesav = deadconn->type; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
133 subtypesav = deadconn->subtype; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
134 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
135 if (deadconn->priv && (deadconn->type != AIM_CONN_TYPE_RENDEZVOUS)) { |
237 | 136 free(deadconn->priv); |
638
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
137 deadconn->priv = NULL; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
138 } |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
139 privsav = deadconn->priv; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
140 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
141 aim_conn_init(deadconn); |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
142 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
143 deadconn->type = typesav; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
144 deadconn->subtype = subtypesav; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
145 deadconn->priv = privsav; |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
146 |
525c566741da
[gaim-migrate @ 648]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
445
diff
changeset
|
147 return; |
2 | 148 } |
149 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
150 faim_internal struct aim_conn_t *aim_getconn_type(struct aim_session_t *sess, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
151 int type) |
2 | 152 { |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
153 struct aim_conn_t *cur; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
154 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
155 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
156 for (cur = sess->connlist; cur; cur = cur->next) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
157 if (cur->type == type) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
158 break; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
159 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
160 faim_mutex_unlock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
161 return cur; |
2 | 162 } |
163 | |
164 /* | |
165 * aim_newconn(type, dest) | |
166 * | |
167 * Opens a new connection to the specified dest host of type type. | |
168 * | |
169 * TODO: fix for proxies | |
170 * FIXME: Return errors in a more sane way. | |
171 * | |
172 */ | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
173 faim_export struct aim_conn_t *aim_newconn(struct aim_session_t *sess, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
174 int type, char *dest) |
2 | 175 { |
176 struct aim_conn_t *connstruct; | |
177 int ret; | |
178 struct sockaddr_in sa; | |
179 struct hostent *hp; | |
237 | 180 u_short port = FAIM_LOGIN_PORT; |
181 char *host = NULL; | |
2 | 182 int i=0; |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
183 |
237 | 184 if ((connstruct=aim_conn_getnext(sess))==NULL) |
2 | 185 return NULL; |
186 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
187 faim_mutex_lock(&connstruct->active); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
188 |
2 | 189 connstruct->type = type; |
190 | |
237 | 191 if (!dest) { /* just allocate a struct */ |
192 connstruct->fd = -1; | |
193 connstruct->status = 0; | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
194 faim_mutex_unlock(&connstruct->active); |
237 | 195 return connstruct; |
196 } | |
197 | |
2 | 198 /* |
199 * As of 23 Jul 1999, AOL now sends the port number, preceded by a | |
200 * colon, in the BOS redirect. This fatally breaks all previous | |
201 * libfaims. Bad, bad AOL. | |
202 * | |
203 * We put this here to catch every case. | |
204 * | |
205 */ | |
237 | 206 |
889
e1da6a6ec42b
[gaim-migrate @ 899]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
840
diff
changeset
|
207 for(i=0;i<(int)strlen(dest);i++) { |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
208 if (dest[i] == ':') { |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
209 port = atoi(&(dest[i+1])); |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
210 break; |
237 | 211 } |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
212 } |
237 | 213 host = (char *)malloc(i+1); |
214 strncpy(host, dest, i); | |
215 host[i] = '\0'; | |
2 | 216 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
217 hp = gethostbyname(host); |
237 | 218 free(host); |
219 | |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
220 if (hp == NULL) { |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
221 connstruct->status = (h_errno | AIM_CONN_STATUS_RESOLVERR); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
222 faim_mutex_unlock(&connstruct->active); |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
223 return connstruct; |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
224 } |
2 | 225 |
226 memset(&sa.sin_zero, 0, 8); | |
227 sa.sin_port = htons(port); | |
228 memcpy(&sa.sin_addr, hp->h_addr, hp->h_length); | |
229 sa.sin_family = hp->h_addrtype; | |
230 | |
231 connstruct->fd = socket(hp->h_addrtype, SOCK_STREAM, 0); | |
232 ret = connect(connstruct->fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)); | |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
233 if(ret < 0) { |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
234 connstruct->fd = -1; |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
235 connstruct->status = (errno | AIM_CONN_STATUS_CONNERR); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
236 faim_mutex_unlock(&connstruct->active); |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
237 return connstruct; |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
238 } |
237 | 239 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
240 faim_mutex_unlock(&connstruct->active); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
241 |
2 | 242 return connstruct; |
243 } | |
244 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
245 faim_export int aim_conngetmaxfd(struct aim_session_t *sess) |
2 | 246 { |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
247 int j = 0; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
248 struct aim_conn_t *cur; |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
249 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
250 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
251 for (cur = sess->connlist; cur; cur = cur->next) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
252 if (cur->fd > j) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
253 j = cur->fd; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
254 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
255 faim_mutex_unlock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
256 |
2 | 257 return j; |
258 } | |
259 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
260 static int aim_countconn(struct aim_session_t *sess) |
2 | 261 { |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
262 int cnt = 0; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
263 struct aim_conn_t *cur; |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
264 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
265 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
266 for (cur = sess->connlist; cur; cur = cur->next) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
267 cnt++; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
268 faim_mutex_unlock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
269 |
2 | 270 return cnt; |
271 } | |
272 | |
273 /* | |
274 * aim_select(timeout) | |
275 * | |
276 * Waits for a socket with data or for timeout, whichever comes first. | |
277 * See select(2). | |
278 * | |
237 | 279 * Return codes in *status: |
280 * -1 error in select() (NULL returned) | |
281 * 0 no events pending (NULL returned) | |
282 * 1 outgoing data pending (NULL returned) | |
283 * 2 incoming data pending (connection with pending data returned) | |
284 * | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
285 * XXX: we could probably stand to do a little courser locking here. |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
286 * |
2 | 287 */ |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
288 faim_export struct aim_conn_t *aim_select(struct aim_session_t *sess, |
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
289 struct timeval *timeout, int *status) |
2 | 290 { |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
291 struct aim_conn_t *cur; |
2 | 292 fd_set fds; |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
293 int maxfd = 0; |
2 | 294 int i; |
295 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
296 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
297 if (sess->connlist == NULL) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
298 faim_mutex_unlock(&sess->connlistlock); |
445
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
299 *status = -1; |
e4c34ca88d9b
[gaim-migrate @ 455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
300 return NULL; |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
301 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
302 faim_mutex_unlock(&sess->connlistlock); |
237 | 303 |
304 /* | |
305 * If we have data waiting to be sent, return immediatly | |
306 */ | |
307 if (sess->queue_outgoing != NULL) { | |
308 *status = 1; | |
309 return NULL; | |
310 } | |
311 | |
2 | 312 FD_ZERO(&fds); |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
313 maxfd = 0; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
314 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
315 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
316 for (cur = sess->connlist; cur; cur = cur->next) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
317 FD_SET(cur->fd, &fds); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
318 if (cur->fd > maxfd) |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
319 maxfd = cur->fd; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
320 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
321 faim_mutex_unlock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
322 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
323 if ((i = select(maxfd+1, &fds, NULL, NULL, timeout))>=1) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
324 faim_mutex_lock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
325 for (cur = sess->connlist; cur; cur = cur->next) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
326 if (FD_ISSET(cur->fd, &fds)) { |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
327 *status = 2; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
328 faim_mutex_unlock(&sess->connlistlock); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
329 return cur; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
330 } |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
331 } |
817
aefd5f2b1ea0
[gaim-migrate @ 827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
715
diff
changeset
|
332 *status = 0; /* shouldn't happen */ |
aefd5f2b1ea0
[gaim-migrate @ 827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
715
diff
changeset
|
333 } else if ((i == -1) && (errno == EINTR)) /* treat interrupts as a timeout */ |
aefd5f2b1ea0
[gaim-migrate @ 827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
715
diff
changeset
|
334 *status = 0; |
aefd5f2b1ea0
[gaim-migrate @ 827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
715
diff
changeset
|
335 else |
aefd5f2b1ea0
[gaim-migrate @ 827]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
715
diff
changeset
|
336 *status = i; /* can be 0 or -1 */ |
237 | 337 |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
338 faim_mutex_unlock(&sess->connlistlock); |
237 | 339 return NULL; /* no waiting or error, return */ |
2 | 340 } |
341 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
342 faim_export int aim_conn_isready(struct aim_conn_t *conn) |
2 | 343 { |
344 if (conn) | |
345 return (conn->status & 0x0001); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
346 return -1; |
2 | 347 } |
348 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
349 faim_export int aim_conn_setstatus(struct aim_conn_t *conn, int status) |
2 | 350 { |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
351 int val; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
352 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
353 if (!conn) |
2 | 354 return -1; |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
355 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
356 faim_mutex_lock(&conn->active); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
357 val = conn->status ^= status; |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
358 faim_mutex_unlock(&conn->active); |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
359 return val; |
2 | 360 } |
361 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
362 faim_export int aim_conn_setlatency(struct aim_conn_t *conn, int newval) |
237 | 363 { |
364 if (!conn) | |
365 return -1; | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
366 |
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
367 faim_mutex_lock(&conn->active); |
237 | 368 conn->forcedlatency = newval; |
369 conn->lastactivity = 0; /* reset this just to make sure */ | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
370 faim_mutex_unlock(&conn->active); |
237 | 371 |
372 return 0; | |
373 } | |
374 | |
840
595ac7759563
[gaim-migrate @ 850]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
817
diff
changeset
|
375 faim_export void aim_session_init(struct aim_session_t *sess) |
237 | 376 { |
377 if (!sess) | |
378 return; | |
379 | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
283
diff
changeset
|
380 memset(sess, 0, sizeof(struct aim_session_t)); |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
381 aim_connrst(sess); |
237 | 382 sess->queue_outgoing = NULL; |
383 sess->queue_incoming = NULL; | |
384 sess->pendingjoin = NULL; | |
715
58106806ac2b
[gaim-migrate @ 725]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
711
diff
changeset
|
385 aim_initsnachash(sess); |
237 | 386 sess->snac_nextid = 0x00000001; |
387 | |
279
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
388 /* |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
389 * This must always be set. Default to the queue-based |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
390 * version for back-compatibility. |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
391 */ |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
392 sess->tx_enqueue = &aim_tx_enqueue__queuebased; |
501e09c51cbc
[gaim-migrate @ 289]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
237
diff
changeset
|
393 |
237 | 394 return; |
395 } |