53 |
|
#include "memory.h" |
54 |
|
#include "mempool.h" |
55 |
|
#include "ircd_getopt.h" |
56 |
– |
#include "supported.h" |
56 |
|
#include "watch.h" |
57 |
|
#include "conf_db.h" |
58 |
|
#include "conf_class.h" |
62 |
|
GeoIP *geoip_ctx; |
63 |
|
#endif |
64 |
|
|
66 |
– |
/* /quote set variables */ |
67 |
– |
struct SetOptions GlobalSetOptions; |
68 |
– |
struct Counter Count; |
69 |
– |
struct ServerState_t server_state; |
65 |
|
struct ServerStatistics ServerStats; |
66 |
|
struct timeval SystemTime; |
67 |
|
struct Client me; /* That's me */ |
84 |
|
unsigned int split_users; |
85 |
|
unsigned int split_servers; |
86 |
|
|
87 |
+ |
static struct event event_cleanup_glines = |
88 |
+ |
{ |
89 |
+ |
.name = "cleanup_glines", |
90 |
+ |
.handler = cleanup_glines, |
91 |
+ |
.when = CLEANUP_GLINES_TIME |
92 |
+ |
}; |
93 |
+ |
|
94 |
+ |
static struct event event_cleanup_tklines = |
95 |
+ |
{ |
96 |
+ |
.name = "cleanup_tklines", |
97 |
+ |
.handler = cleanup_tklines, |
98 |
+ |
.when = CLEANUP_TKLINES_TIME |
99 |
+ |
}; |
100 |
+ |
|
101 |
+ |
static struct event event_try_connections = |
102 |
+ |
{ |
103 |
+ |
.name = "try_connections", |
104 |
+ |
.handler = try_connections, |
105 |
+ |
.when = STARTUP_CONNECTIONS_TIME |
106 |
+ |
}; |
107 |
+ |
|
108 |
+ |
static struct event event_comm_checktimeouts = |
109 |
+ |
{ |
110 |
+ |
.name = "comm_checktimeouts", |
111 |
+ |
.handler = comm_checktimeouts, |
112 |
+ |
.when = 1 |
113 |
+ |
}; |
114 |
+ |
|
115 |
+ |
static struct event event_save_all_databases = |
116 |
+ |
{ |
117 |
+ |
.name = "save_all_databases", |
118 |
+ |
.handler = save_all_databases, |
119 |
+ |
.when = DATABASE_UPDATE_TIMEOUT |
120 |
+ |
}; |
121 |
+ |
|
122 |
+ |
struct event event_write_links_file = |
123 |
+ |
{ |
124 |
+ |
.name = "write_links_file", |
125 |
+ |
.handler = write_links_file, |
126 |
+ |
}; |
127 |
+ |
|
128 |
+ |
|
129 |
|
/* |
130 |
|
* print_startup - print startup information |
131 |
|
*/ |
227 |
|
safe_list_channels(ptr->data, 0); |
228 |
|
} |
229 |
|
|
230 |
< |
/* Run pending events, then get the number of seconds to the next |
231 |
< |
* event |
195 |
< |
*/ |
196 |
< |
while (eventNextTime() <= CurrentTime) |
197 |
< |
eventRun(); |
230 |
> |
/* Run pending events */ |
231 |
> |
event_run(); |
232 |
|
|
233 |
|
comm_select(); |
234 |
|
exit_aborted_clients(); |
427 |
|
|
428 |
|
if ((ServerInfo.server_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL) |
429 |
|
{ |
430 |
< |
const char *s; |
430 |
> |
const char *s = ERR_lib_error_string(ERR_get_error()); |
431 |
|
|
432 |
< |
fprintf(stderr, "ERROR: Could not initialize the SSL Server context -- %s\n", |
399 |
< |
s = ERR_lib_error_string(ERR_get_error())); |
432 |
> |
fprintf(stderr, "ERROR: Could not initialize the SSL Server context -- %s\n", s); |
433 |
|
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s\n", s); |
434 |
|
} |
435 |
|
|
436 |
|
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
437 |
< |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG); |
437 |
> |
SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_SINGLE_DH_USE); |
438 |
|
SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, |
439 |
|
always_accept_verify_cb); |
440 |
|
SSL_CTX_set_session_id_context(ServerInfo.server_ctx, session_id, sizeof(session_id) - 1); |
455 |
|
|
456 |
|
if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL) |
457 |
|
{ |
458 |
< |
const char *s; |
458 |
> |
const char *s = ERR_lib_error_string(ERR_get_error()); |
459 |
|
|
460 |
< |
fprintf(stderr, "ERROR: Could not initialize the SSL Client context -- %s\n", |
428 |
< |
s = ERR_lib_error_string(ERR_get_error())); |
460 |
> |
fprintf(stderr, "ERROR: Could not initialize the SSL Client context -- %s\n", s); |
461 |
|
ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s\n", s); |
462 |
|
} |
463 |
|
|
464 |
|
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1); |
465 |
< |
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG); |
465 |
> |
SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_SINGLE_DH_USE); |
466 |
|
SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, |
467 |
|
always_accept_verify_cb); |
468 |
|
#endif /* HAVE_LIBCRYPTO */ |
530 |
|
|
531 |
|
setup_signals(); |
532 |
|
|
501 |
– |
/* Init the event subsystem */ |
502 |
– |
eventInit(); |
503 |
– |
|
533 |
|
/* We need this to initialise the fd array before anything else */ |
534 |
|
fdlist_init(); |
535 |
|
log_set_file(LOG_TYPE_IRCD, 0, logFileName); |
637 |
|
|
638 |
|
ilog(LOG_TYPE_IRCD, "Server Ready"); |
639 |
|
|
640 |
< |
eventAddIsh("cleanup_glines", cleanup_glines, NULL, CLEANUP_GLINES_TIME); |
641 |
< |
eventAddIsh("cleanup_tklines", cleanup_tklines, NULL, CLEANUP_TKLINES_TIME); |
640 |
> |
event_addish(&event_cleanup_glines, NULL); |
641 |
> |
event_addish(&event_cleanup_tklines, NULL); |
642 |
|
|
643 |
|
/* We want try_connections to be called as soon as possible now! -- adrian */ |
644 |
|
/* No, 'cause after a restart it would cause all sorts of nick collides */ |
645 |
< |
eventAddIsh("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME); |
645 |
> |
event_addish(&event_try_connections, NULL); |
646 |
|
|
647 |
|
/* Setup the timeout check. I'll shift it later :) -- adrian */ |
648 |
< |
eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1); |
648 |
> |
event_addish(&event_comm_checktimeouts, NULL); |
649 |
|
|
650 |
< |
eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT); |
650 |
> |
event_addish(&event_save_all_databases, NULL); |
651 |
|
|
652 |
|
if (ConfigServerHide.links_delay > 0) |
653 |
< |
eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay); |
653 |
> |
{ |
654 |
> |
event_write_links_file.when = ConfigServerHide.links_delay; |
655 |
> |
event_addish(&event_write_links_file, NULL); |
656 |
> |
} |
657 |
|
else |
658 |
|
ConfigServerHide.links_disabled = 1; |
659 |
|
|
660 |
|
if (splitmode) |
661 |
< |
eventAddIsh("check_splitmode", check_splitmode, NULL, 60); |
661 |
> |
event_addish(&splitmode_event, NULL); |
662 |
|
|
663 |
|
io_loop(); |
664 |
|
return 0; |