49 |
|
#include "s_conf.h" |
50 |
|
#include "s_log.h" |
51 |
|
#include "s_serv.h" |
52 |
– |
#include "s_stats.h" |
52 |
|
#include "send.h" |
53 |
|
#include "memory.h" |
54 |
|
#include "s_user.h" |
65 |
|
static void comm_connect_dns_callback(void *vptr, struct DNSReply *reply); |
66 |
|
static PF comm_connect_tryconnect; |
67 |
|
|
69 |
– |
extern void init_netio(void); |
68 |
|
|
69 |
|
/* check_can_use_v6() |
70 |
|
* Check if the system can open AF_INET6 sockets |
199 |
|
|
200 |
|
assert(NULL != client_p); |
201 |
|
|
202 |
+ |
if (!IsDead(client_p)) |
203 |
+ |
{ |
204 |
+ |
/* attempt to flush any pending dbufs. Evil, but .. -- adrian */ |
205 |
+ |
/* there is still a chance that we might send data to this socket |
206 |
+ |
* even if it is marked as blocked (COMM_SELECT_READ handler is called |
207 |
+ |
* before COMM_SELECT_WRITE). Let's try, nothing to lose.. -adx |
208 |
+ |
*/ |
209 |
+ |
ClearSendqBlocked(client_p); |
210 |
+ |
send_queued_write(client_p); |
211 |
+ |
} |
212 |
+ |
|
213 |
|
if (IsServer(client_p)) |
214 |
|
{ |
215 |
< |
ServerStats->is_sv++; |
216 |
< |
ServerStats->is_sbs += client_p->localClient->send.bytes; |
217 |
< |
ServerStats->is_sbr += client_p->localClient->recv.bytes; |
218 |
< |
ServerStats->is_sti += CurrentTime - client_p->firsttime; |
215 |
> |
++ServerStats.is_sv; |
216 |
> |
ServerStats.is_sbs += client_p->localClient->send.bytes; |
217 |
> |
ServerStats.is_sbr += client_p->localClient->recv.bytes; |
218 |
> |
ServerStats.is_sti += CurrentTime - client_p->firsttime; |
219 |
|
|
220 |
|
/* XXX Does this even make any sense at all anymore? |
221 |
|
* scheduling a 'quick' reconnect could cause a pile of |
246 |
|
} |
247 |
|
else if (IsClient(client_p)) |
248 |
|
{ |
249 |
< |
ServerStats->is_cl++; |
250 |
< |
ServerStats->is_cbs += client_p->localClient->send.bytes; |
251 |
< |
ServerStats->is_cbr += client_p->localClient->recv.bytes; |
252 |
< |
ServerStats->is_cti += CurrentTime - client_p->firsttime; |
249 |
> |
++ServerStats.is_cl; |
250 |
> |
ServerStats.is_cbs += client_p->localClient->send.bytes; |
251 |
> |
ServerStats.is_cbr += client_p->localClient->recv.bytes; |
252 |
> |
ServerStats.is_cti += CurrentTime - client_p->firsttime; |
253 |
|
} |
254 |
|
else |
255 |
< |
ServerStats->is_ni++; |
247 |
< |
|
248 |
< |
if (!IsDead(client_p)) |
249 |
< |
{ |
250 |
< |
/* attempt to flush any pending dbufs. Evil, but .. -- adrian */ |
251 |
< |
/* there is still a chance that we might send data to this socket |
252 |
< |
* even if it is marked as blocked (COMM_SELECT_READ handler is called |
253 |
< |
* before COMM_SELECT_WRITE). Let's try, nothing to lose.. -adx |
254 |
< |
*/ |
255 |
< |
ClearSendqBlocked(client_p); |
256 |
< |
send_queued_write(client_p); |
257 |
< |
} |
255 |
> |
++ServerStats.is_ni; |
256 |
|
|
257 |
|
#ifdef HAVE_LIBCRYPTO |
258 |
|
if (client_p->localClient->fd.ssl) |
356 |
|
#endif |
357 |
|
strlcat(new_client->host, new_client->sockhost,HOSTLEN+1); |
358 |
|
|
361 |
– |
new_client->connect_id = ++connect_id; |
359 |
|
new_client->localClient->listener = listener; |
360 |
|
++listener->ref_count; |
361 |
|
|
547 |
|
fd->dns_query = MyMalloc(sizeof(struct DNSQuery)); |
548 |
|
fd->dns_query->ptr = fd; |
549 |
|
fd->dns_query->callback = comm_connect_dns_callback; |
550 |
< |
gethost_byname(host, fd->dns_query); |
550 |
> |
if (aftype == AF_INET6) |
551 |
> |
gethost_byname_type(host, fd->dns_query, T_AAAA); |
552 |
> |
else |
553 |
> |
gethost_byname_type(host, fd->dns_query, T_A); |
554 |
|
} |
555 |
|
else |
556 |
|
{ |