mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 15:00:51 +01:00
Automated merge with ssh://hg.atheme.org//hg/charybdis
This commit is contained in:
commit
6bfe3faec0
3 changed files with 29 additions and 15 deletions
|
@ -44,19 +44,19 @@ extern struct Dictionary *nd_dict;
|
|||
#define FNV1_32_INIT 0x811c9dc5UL
|
||||
|
||||
/* Client hash table size, used in hash.c/s_debug.c */
|
||||
#define U_MAX_BITS (32-17)
|
||||
#define U_MAX_BITS 17
|
||||
#define U_MAX 131072 /* 2^17 */
|
||||
|
||||
/* Channel hash table size, hash.c/s_debug.c */
|
||||
#define CH_MAX_BITS (32-16)
|
||||
#define CH_MAX_BITS 16
|
||||
#define CH_MAX 65536 /* 2^16 */
|
||||
|
||||
/* hostname hash table size */
|
||||
#define HOST_MAX_BITS (32-17)
|
||||
#define HOST_MAX_BITS 17
|
||||
#define HOST_MAX 131072 /* 2^17 */
|
||||
|
||||
/* RESV/XLINE hash table size, used in hash.c */
|
||||
#define R_MAX_BITS (32-10)
|
||||
#define R_MAX_BITS 10
|
||||
#define R_MAX 1024 /* 2^10 */
|
||||
|
||||
|
||||
|
|
12
src/hash.c
12
src/hash.c
|
@ -109,7 +109,8 @@ fnv_hash_upper(const unsigned char *s, int bits)
|
|||
h ^= ToUpper(*s++);
|
||||
h += (h<<1) + (h<<4) + (h<<7) + (h << 8) + (h << 24);
|
||||
}
|
||||
h = (h >> bits) ^ (h & ((2^bits)-1));
|
||||
if (bits < 32)
|
||||
h = ((h >> bits) ^ h) & ((1<<bits)-1);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
@ -123,7 +124,8 @@ fnv_hash(const unsigned char *s, int bits)
|
|||
h ^= *s++;
|
||||
h += (h<<1) + (h<<4) + (h<<7) + (h << 8) + (h << 24);
|
||||
}
|
||||
h = (h >> bits) ^ (h & ((2^bits)-1));
|
||||
if (bits < 32)
|
||||
h = ((h >> bits) ^ h) & ((1<<bits)-1);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
@ -137,7 +139,8 @@ fnv_hash_len(const unsigned char *s, int bits, int len)
|
|||
h ^= *s++;
|
||||
h += (h<<1) + (h<<4) + (h<<7) + (h << 8) + (h << 24);
|
||||
}
|
||||
h = (h >> bits) ^ (h & ((2^bits)-1));
|
||||
if (bits < 32)
|
||||
h = ((h >> bits) ^ h) & ((1<<bits)-1);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
@ -151,7 +154,8 @@ fnv_hash_upper_len(const unsigned char *s, int bits, int len)
|
|||
h ^= ToUpper(*s++);
|
||||
h += (h<<1) + (h<<4) + (h<<7) + (h << 8) + (h << 24);
|
||||
}
|
||||
h = (h >> bits) ^ (h & ((2^bits)-1));
|
||||
if (bits < 32)
|
||||
h = ((h >> bits) ^ h) & ((1<<bits)-1);
|
||||
return h;
|
||||
}
|
||||
#endif
|
||||
|
|
24
src/s_serv.c
24
src/s_serv.c
|
@ -1476,6 +1476,7 @@ serv_connect(struct server_conf *server_p, struct Client *by)
|
|||
struct Client *client_p;
|
||||
struct irc_sockaddr_storage myipnum;
|
||||
int fd;
|
||||
char vhoststr[HOSTIPLEN];
|
||||
|
||||
s_assert(server_p != NULL);
|
||||
if(server_p == NULL)
|
||||
|
@ -1565,13 +1566,6 @@ serv_connect(struct server_conf *server_p, struct Client *by)
|
|||
SetConnecting(client_p);
|
||||
dlinkAddTail(client_p, &client_p->node, &global_client_list);
|
||||
|
||||
/* log */
|
||||
ilog(L_SERVER, "Connecting to %s[%s] port %d (%s)", server_p->name, server_p->host, server_p->port,
|
||||
#ifdef IPV6
|
||||
server_p->aftype == AF_INET6 ? "IPv6" :
|
||||
#endif
|
||||
(server_p->aftype == AF_INET ? "IPv4" : "?"));
|
||||
|
||||
if(ServerConfVhosted(server_p))
|
||||
{
|
||||
memcpy(&myipnum, &server_p->my_ipnum, sizeof(myipnum));
|
||||
|
@ -1598,6 +1592,13 @@ serv_connect(struct server_conf *server_p, struct Client *by)
|
|||
#endif
|
||||
else
|
||||
{
|
||||
/* log */
|
||||
ilog(L_SERVER, "Connecting to %s[%s] port %d (%s)", server_p->name, server_p->host, server_p->port,
|
||||
#ifdef IPV6
|
||||
server_p->aftype == AF_INET6 ? "IPv6" :
|
||||
#endif
|
||||
(server_p->aftype == AF_INET ? "IPv4" : "?"));
|
||||
|
||||
comm_connect_tcp(client_p->localClient->fd, server_p->host,
|
||||
server_p->port, NULL, 0, serv_connect_callback,
|
||||
client_p, server_p->aftype,
|
||||
|
@ -1605,6 +1606,15 @@ serv_connect(struct server_conf *server_p, struct Client *by)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* log */
|
||||
inetntop_sock((struct sockaddr *)&myipnum, vhoststr, sizeof vhoststr);
|
||||
ilog(L_SERVER, "Connecting to %s[%s] port %d (%s) (vhost %s)", server_p->name, server_p->host, server_p->port,
|
||||
#ifdef IPV6
|
||||
server_p->aftype == AF_INET6 ? "IPv6" :
|
||||
#endif
|
||||
(server_p->aftype == AF_INET ? "IPv4" : "?"), vhoststr);
|
||||
|
||||
|
||||
comm_connect_tcp(client_p->localClient->fd, server_p->host,
|
||||
server_p->port, (struct sockaddr *) &myipnum,
|
||||
GET_SS_LEN(myipnum), serv_connect_callback, client_p,
|
||||
|
|
Loading…
Reference in a new issue