30 |
|
#include "fdlist.h" |
31 |
|
#include "s_bsd.h" |
32 |
|
#include "client.h" |
33 |
– |
#include "common.h" |
33 |
|
#include "dbuf.h" |
34 |
|
#include "event.h" |
35 |
|
#include "irc_string.h" |
40 |
|
#include "irc_res.h" |
41 |
|
#include "restart.h" |
42 |
|
#include "s_auth.h" |
43 |
< |
#include "s_conf.h" |
44 |
< |
#include "s_log.h" |
43 |
> |
#include "conf.h" |
44 |
> |
#include "log.h" |
45 |
|
#include "s_serv.h" |
46 |
|
#include "send.h" |
47 |
|
#include "memory.h" |
129 |
|
{ |
130 |
|
who = (who) ? who : ""; |
131 |
|
|
132 |
< |
sendto_realops_flags(UMODE_DEBUG, level, text, who, strerror(error)); |
133 |
< |
log_oper_action(LOG_IOERR_TYPE, NULL, "%s %s %s\n", who, text, strerror(error)); |
134 |
< |
ilog(L_ERROR, text, who, strerror(error)); |
132 |
> |
sendto_realops_flags(UMODE_DEBUG, level, SEND_NOTICE, |
133 |
> |
text, who, strerror(error)); |
134 |
> |
ilog(LOG_TYPE_IRCD, text, who, strerror(error)); |
135 |
|
} |
136 |
|
|
137 |
|
/* |
177 |
|
void |
178 |
|
close_connection(struct Client *client_p) |
179 |
|
{ |
181 |
– |
struct ConfItem *conf; |
180 |
|
struct AccessItem *aconf; |
181 |
|
struct ClassItem *aclass; |
182 |
+ |
dlink_node *ptr = NULL; |
183 |
|
|
184 |
< |
assert(NULL != client_p); |
184 |
> |
assert(client_p); |
185 |
|
|
186 |
|
if (!IsDead(client_p)) |
187 |
|
{ |
194 |
|
send_queued_write(client_p); |
195 |
|
} |
196 |
|
|
197 |
< |
if (IsServer(client_p)) |
197 |
> |
if (IsClient(client_p)) |
198 |
> |
{ |
199 |
> |
++ServerStats.is_cl; |
200 |
> |
ServerStats.is_cbs += client_p->localClient->send.bytes; |
201 |
> |
ServerStats.is_cbr += client_p->localClient->recv.bytes; |
202 |
> |
ServerStats.is_cti += CurrentTime - client_p->localClient->firsttime; |
203 |
> |
} |
204 |
> |
else if (IsServer(client_p)) |
205 |
|
{ |
206 |
|
++ServerStats.is_sv; |
207 |
|
ServerStats.is_sbs += client_p->localClient->send.bytes; |
208 |
|
ServerStats.is_sbr += client_p->localClient->recv.bytes; |
209 |
< |
ServerStats.is_sti += CurrentTime - client_p->firsttime; |
209 |
> |
ServerStats.is_sti += CurrentTime - client_p->localClient->firsttime; |
210 |
|
|
211 |
< |
/* XXX Does this even make any sense at all anymore? |
206 |
< |
* scheduling a 'quick' reconnect could cause a pile of |
207 |
< |
* nick collides under TSora protocol... -db |
208 |
< |
*/ |
209 |
< |
/* |
210 |
< |
* If the connection has been up for a long amount of time, schedule |
211 |
< |
* a 'quick' reconnect, else reset the next-connect cycle. |
212 |
< |
*/ |
213 |
< |
if ((conf = find_conf_exact(SERVER_TYPE, client_p->name, |
214 |
< |
client_p->username, client_p->host))) |
211 |
> |
DLINK_FOREACH(ptr, server_items.head) |
212 |
|
{ |
213 |
+ |
struct ConfItem *conf = ptr->data; |
214 |
+ |
|
215 |
+ |
if (irccmp(conf->name, client_p->name)) |
216 |
+ |
continue; |
217 |
+ |
|
218 |
|
/* |
219 |
< |
* Reschedule a faster reconnect, if this was a automatically |
220 |
< |
* connected configuration entry. (Note that if we have had |
219 |
< |
* a rehash in between, the status has been changed to |
220 |
< |
* CONF_ILLEGAL). But only do this if it was a "good" link. |
219 |
> |
* Reset next-connect cycle of all connect{} blocks that match |
220 |
> |
* this servername. |
221 |
|
*/ |
222 |
|
aconf = map_to_conf(conf); |
223 |
|
aclass = map_to_conf(aconf->class_ptr); |
224 |
< |
aconf->hold = time(NULL); |
225 |
< |
aconf->hold += (aconf->hold - client_p->since > HANGONGOODLINK) ? |
226 |
< |
HANGONRETRYDELAY : ConFreq(aclass); |
224 |
> |
aconf->hold = CurrentTime + aclass->con_freq; |
225 |
|
} |
226 |
|
} |
229 |
– |
else if (IsClient(client_p)) |
230 |
– |
{ |
231 |
– |
++ServerStats.is_cl; |
232 |
– |
ServerStats.is_cbs += client_p->localClient->send.bytes; |
233 |
– |
ServerStats.is_cbr += client_p->localClient->recv.bytes; |
234 |
– |
ServerStats.is_cti += CurrentTime - client_p->firsttime; |
235 |
– |
} |
227 |
|
else |
228 |
|
++ServerStats.is_ni; |
229 |
|
|
239 |
|
if (client_p->localClient->fd.flags.open) |
240 |
|
fd_close(&client_p->localClient->fd); |
241 |
|
|
251 |
– |
if (HasServlink(client_p)) |
252 |
– |
{ |
253 |
– |
if (client_p->localClient->ctrlfd.flags.open) |
254 |
– |
fd_close(&client_p->localClient->ctrlfd); |
255 |
– |
} |
256 |
– |
|
242 |
|
dbuf_clear(&client_p->localClient->buf_sendq); |
243 |
|
dbuf_clear(&client_p->localClient->buf_recvq); |
244 |
|
|
324 |
|
{ |
325 |
|
if ((new_client->localClient->fd.ssl = SSL_new(ServerInfo.server_ctx)) == NULL) |
326 |
|
{ |
327 |
< |
ilog(L_CRIT, "SSL_new() ERROR! -- %s", |
327 |
> |
ilog(LOG_TYPE_IRCD, "SSL_new() ERROR! -- %s", |
328 |
|
ERR_error_string(ERR_get_error(), NULL)); |
329 |
|
|
330 |
|
SetDead(new_client); |