ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/src/ircd.c
(Generate patch)

Comparing:
ircd-hybrid/trunk/src/ircd.c (file contents), Revision 3321 by michael, Tue Apr 15 16:02:56 2014 UTC vs.
ircd-hybrid/branches/8.2.x/src/ircd.c (file contents), Revision 4095 by michael, Sun Jun 29 11:51:22 2014 UTC

# Line 25 | Line 25
25   */
26  
27   #include "stdinc.h"
28 < #include "s_user.h"
28 > #include "user.h"
29   #include "list.h"
30   #include "ircd.h"
31   #include "channel.h"
# Line 40 | Line 40
40   #include "conf.h"
41   #include "hostmask.h"
42   #include "parse.h"
43 < #include "irc_res.h"
43 > #include "res.h"
44   #include "restart.h"
45   #include "rng_mt.h"
46 < #include "s_auth.h"
46 > #include "auth.h"
47   #include "s_bsd.h"
48   #include "log.h"
49 < #include "s_serv.h"      /* try_connections */
49 > #include "server.h"      /* try_connections */
50   #include "send.h"
51   #include "whowas.h"
52   #include "modules.h"
# Line 83 | Line 83 | int doremotd = 0;
83   /* Set to zero because it should be initialized later using
84   * initialize_server_capabs
85   */
86 < int default_server_capabs = 0;
86 > unsigned int default_server_capabs;
87   unsigned int splitmode;
88   unsigned int splitchecking;
89   unsigned int split_users;
90   unsigned int split_servers;
91  
92 < /* Do klines the same way hybrid-6 did them, i.e. at the
93 < * top of the next io_loop instead of in the same loop as
94 < * the klines are being applied.
95 < *
96 < * This should fix strange CPU starvation as very indirectly reported.
97 < * (Why do you people not email bug reports? WHY? WHY?)
98 < *
99 < * - Dianora
100 < */
92 > static struct event event_cleanup_glines =
93 > {
94 >  .name = "cleanup_glines",
95 >  .handler = cleanup_glines,
96 >  .when = CLEANUP_GLINES_TIME
97 > };
98 >
99 > static struct event event_cleanup_tklines =
100 > {
101 >  .name = "cleanup_tklines",
102 >  .handler = cleanup_tklines,
103 >  .when = CLEANUP_TKLINES_TIME
104 > };
105 >
106 > static struct event event_try_connections =
107 > {
108 >  .name = "try_connections",
109 >  .handler = try_connections,
110 >  .when = STARTUP_CONNECTIONS_TIME
111 > };
112 >
113 > static struct event event_comm_checktimeouts =
114 > {
115 >  .name = "comm_checktimeouts",
116 >  .handler = comm_checktimeouts,
117 >  .when = 1
118 > };
119  
120 < int rehashed_klines = 0;
120 > static struct event event_save_all_databases =
121 > {
122 >  .name = "save_all_databases",
123 >  .handler = save_all_databases,
124 >  .when = DATABASE_UPDATE_TIMEOUT
125 > };
126 >
127 > struct event event_write_links_file =
128 > {
129 >  .name = "write_links_file",
130 >  .handler = write_links_file,
131 > };
132  
133 + struct event event_check_splitmode =
134 + {
135 +  .name = "check_splitmode",
136 +  .handler = check_splitmode,
137 +  .when = 60
138 + };
139  
140   /*
141   * print_startup - print startup information
# Line 196 | Line 231 | io_loop(void)
231   {
232    while (1)
233    {
199    /*
200     * Maybe we want a flags word?
201     * ie. if (REHASHED_KLINES(global_flags))
202     * SET_REHASHED_KLINES(global_flags)
203     * CLEAR_REHASHED_KLINES(global_flags)
204     *
205     * - Dianora
206     */
207    if (rehashed_klines)
208    {
209      check_conf_klines();
210      rehashed_klines = 0;
211    }
212
234      if (listing_client_list.head)
235      {
236        dlink_node *ptr = NULL, *ptr_next = NULL;
# Line 217 | Line 238 | io_loop(void)
238          safe_list_channels(ptr->data, 0);
239      }
240  
241 <    /* Run pending events, then get the number of seconds to the next
242 <     * event
222 <     */
223 <    while (eventNextTime() <= CurrentTime)
224 <      eventRun();
241 >    /* Run pending events */
242 >    event_run();
243  
244      comm_select();
245      exit_aborted_clients();
# Line 296 | Line 314 | initialize_server_capabs(void)
314    add_capability("CLUSTER", CAP_CLUSTER, 1);
315    add_capability("SVS", CAP_SVS, 1);
316    add_capability("CHW", CAP_CHW, 1);
299 #ifdef HALFOPS
317    add_capability("HOPS", CAP_HOPS, 1);
301 #endif
318   }
319  
320   /* write_pidfile()
# Line 430 | Line 446 | ssl_init(void)
446    }
447  
448    SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1);
449 <  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
449 >  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_TLS_ROLLBACK_BUG);
450    SSL_CTX_set_verify(ServerInfo.server_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
451                       always_accept_verify_cb);
452    SSL_CTX_set_session_id_context(ServerInfo.server_ctx, session_id, sizeof(session_id) - 1);
453  
454 + #if OPENSSL_VERSION_NUMBER >= 0x1000005FL && !defined(OPENSSL_NO_ECDH)
455 +  {
456 +    EC_KEY *key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
457 +
458 +    if (key)
459 +    {
460 +      SSL_CTX_set_tmp_ecdh(ServerInfo.server_ctx, key);
461 +      EC_KEY_free(key);
462 +    }
463 +  }
464 +
465 +  SSL_CTX_set_options(ServerInfo.server_ctx, SSL_OP_SINGLE_ECDH_USE);
466 + #endif
467 +
468    if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL)
469    {
470      const char *s;
# Line 445 | Line 475 | ssl_init(void)
475    }
476  
477    SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3|SSL_OP_NO_TLSv1);
478 <  SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG|SSL_OP_ALL);
478 >  SSL_CTX_set_options(ServerInfo.client_ctx, SSL_OP_TLS_ROLLBACK_BUG);
479    SSL_CTX_set_verify(ServerInfo.client_ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
480                       always_accept_verify_cb);
481   #endif /* HAVE_LIBCRYPTO */
# Line 457 | Line 487 | main(int argc, char *argv[])
487    /* Check to see if the user is running us as root, which is a nono */
488    if (geteuid() == 0)
489    {
490 <    fprintf(stderr, "Don't run ircd as root!!!\n");
490 >    fprintf(stderr, "ERROR: This server won't run as root/superuser\n");
491      return -1;
492    }
493  
# Line 473 | Line 503 | main(int argc, char *argv[])
503    me.localClient = &meLocalUser;
504    dlinkAdd(&me, &me.node, &global_client_list);  /* Pointer to beginning
505                                                     of Client list */
506 +  ConfigLoggingEntry.use_logging = 1;
507    ConfigFileEntry.dpath      = DPATH;
508    ConfigFileEntry.spath      = SPATH;
509    ConfigFileEntry.mpath      = MPATH;
# Line 512 | Line 543 | main(int argc, char *argv[])
543  
544    setup_signals();
545  
515  /* Init the event subsystem */
516  eventInit();
517
546    /* We need this to initialise the fd array before anything else */
547    fdlist_init();
548    log_set_file(LOG_TYPE_IRCD, 0, logFileName);
# Line 622 | Line 650 | main(int argc, char *argv[])
650  
651    ilog(LOG_TYPE_IRCD, "Server Ready");
652  
653 <  eventAddIsh("cleanup_glines", cleanup_glines, NULL, CLEANUP_GLINES_TIME);
654 <  eventAddIsh("cleanup_tklines", cleanup_tklines, NULL, CLEANUP_TKLINES_TIME);
653 >  event_addish(&event_cleanup_glines, NULL);
654 >  event_addish(&event_cleanup_tklines, NULL);
655  
656    /* We want try_connections to be called as soon as possible now! -- adrian */
657    /* No, 'cause after a restart it would cause all sorts of nick collides */
658 <  eventAddIsh("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME);
658 >  event_addish(&event_try_connections, NULL);
659  
660    /* Setup the timeout check. I'll shift it later :)  -- adrian */
661 <  eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);
661 >  event_addish(&event_comm_checktimeouts, NULL);
662  
663 <  eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT);
663 >  event_addish(&event_save_all_databases, NULL);
664  
665    if (ConfigServerHide.links_delay > 0)
666 <    eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay);
666 >  {
667 >    event_write_links_file.when = ConfigServerHide.links_delay;
668 >    event_addish(&event_write_links_file, NULL);
669 >  }
670    else
671      ConfigServerHide.links_disabled = 1;
672  
673    if (splitmode)
674 <    eventAddIsh("check_splitmode", check_splitmode, NULL, 60);
674 >    event_addish(&event_check_splitmode, NULL);
675  
676    io_loop();
677    return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)