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

Comparing ircd-hybrid/trunk/src/ircd.c (file contents):
Revision 4073 by michael, Thu Jun 26 15:44:44 2014 UTC vs.
Revision 4129 by michael, Tue Jul 1 19:32:19 2014 UTC

# Line 53 | Line 53
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"
# Line 63 | Line 62
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 */
# Line 89 | Line 84 | unsigned int splitchecking;
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 + struct event event_check_splitmode =
129 + {
130 +  .name = "check_splitmode",
131 +  .handler = check_splitmode,
132 +  .when = 60
133 + };
134 +
135   /*
136   * print_startup - print startup information
137   */
# Line 190 | Line 233 | io_loop(void)
233          safe_list_channels(ptr->data, 0);
234      }
235  
236 <    /* Run pending events, then get the number of seconds to the next
237 <     * event
195 <     */
196 <    while (eventNextTime() <= CurrentTime)
197 <      eventRun();
236 >    /* Run pending events */
237 >    event_run();
238  
239      comm_select();
240      exit_aborted_clients();
# Line 393 | Line 433 | ssl_init(void)
433  
434    if ((ServerInfo.server_ctx = SSL_CTX_new(SSLv23_server_method())) == NULL)
435    {
436 <    const char *s;
436 >    const char *s = ERR_lib_error_string(ERR_get_error());
437  
438 <    fprintf(stderr, "ERROR: Could not initialize the SSL Server context -- %s\n",
399 <            s = ERR_lib_error_string(ERR_get_error()));
438 >    fprintf(stderr, "ERROR: Could not initialize the SSL Server context -- %s\n", s);
439      ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Server context -- %s\n", s);
440    }
441  
# Line 422 | Line 461 | ssl_init(void)
461  
462    if ((ServerInfo.client_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL)
463    {
464 <    const char *s;
464 >    const char *s = ERR_lib_error_string(ERR_get_error());
465  
466 <    fprintf(stderr, "ERROR: Could not initialize the SSL Client context -- %s\n",
428 <            s = ERR_lib_error_string(ERR_get_error()));
466 >    fprintf(stderr, "ERROR: Could not initialize the SSL Client context -- %s\n", s);
467      ilog(LOG_TYPE_IRCD, "ERROR: Could not initialize the SSL Client context -- %s\n", s);
468    }
469  
# Line 458 | Line 496 | main(int argc, char *argv[])
496    me.localClient = &meLocalUser;
497    dlinkAdd(&me, &me.node, &global_client_list);  /* Pointer to beginning
498                                                     of Client list */
499 +  ConfigLoggingEntry.use_logging = 1;
500    ConfigFileEntry.dpath      = DPATH;
501    ConfigFileEntry.spath      = SPATH;
502    ConfigFileEntry.mpath      = MPATH;
# Line 497 | Line 536 | main(int argc, char *argv[])
536  
537    setup_signals();
538  
500  /* Init the event subsystem */
501  eventInit();
502
539    /* We need this to initialise the fd array before anything else */
540    fdlist_init();
541    log_set_file(LOG_TYPE_IRCD, 0, logFileName);
# Line 607 | Line 643 | main(int argc, char *argv[])
643  
644    ilog(LOG_TYPE_IRCD, "Server Ready");
645  
646 <  eventAddIsh("cleanup_glines", cleanup_glines, NULL, CLEANUP_GLINES_TIME);
647 <  eventAddIsh("cleanup_tklines", cleanup_tklines, NULL, CLEANUP_TKLINES_TIME);
646 >  event_addish(&event_cleanup_glines, NULL);
647 >  event_addish(&event_cleanup_tklines, NULL);
648  
649    /* We want try_connections to be called as soon as possible now! -- adrian */
650    /* No, 'cause after a restart it would cause all sorts of nick collides */
651 <  eventAddIsh("try_connections", try_connections, NULL, STARTUP_CONNECTIONS_TIME);
651 >  event_addish(&event_try_connections, NULL);
652  
653    /* Setup the timeout check. I'll shift it later :)  -- adrian */
654 <  eventAddIsh("comm_checktimeouts", comm_checktimeouts, NULL, 1);
654 >  event_addish(&event_comm_checktimeouts, NULL);
655  
656 <  eventAddIsh("save_all_databases", save_all_databases, NULL, DATABASE_UPDATE_TIMEOUT);
656 >  event_addish(&event_save_all_databases, NULL);
657  
658    if (ConfigServerHide.links_delay > 0)
659 <    eventAddIsh("write_links_file", write_links_file, NULL, ConfigServerHide.links_delay);
659 >  {
660 >    event_write_links_file.when = ConfigServerHide.links_delay;
661 >    event_addish(&event_write_links_file, NULL);
662 >  }
663    else
664      ConfigServerHide.links_disabled = 1;
665  
666    if (splitmode)
667 <    eventAddIsh("check_splitmode", check_splitmode, NULL, 60);
667 >    event_addish(&event_check_splitmode, NULL);
668  
669    io_loop();
670    return 0;

Diff Legend

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