X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/47956fc5f8ace10e7b32db88bfb9100ad1829833..6a64b9cea9d7f537ce31c8df38fd738a3657fc39:/src/opserv.c diff --git a/src/opserv.c b/src/opserv.c index a481651..6ef3040 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -30,7 +30,7 @@ #include "saxdb.h" #include "shun.h" -#include +#include #ifdef HAVE_SYS_TIMES_H #include @@ -288,7 +288,7 @@ static const struct message_entry msgtab[] = { { "OSMSG_ROUTINGPLAN_NAME", "$b%s:$b" }, { "OSMSG_ROUTINGPLAN_SERVER"," %s:%d <-- %s[%d/%s] (%s)" }, { "OSMSG_ADDPLAN_SUCCESS", "Added new routing plan '%s'." }, - { "OSMSG_ADDPLAN_FAILURE", "Could not add new plan '%s' (does it already exist?)." }, + { "OSMSG_ADDPLAN_FAILED", "Could not add new plan '%s' (does it already exist?)." }, { "OSMSG_INVALID_PLAN", "That routing plan name is not valid." }, { "OSMSG_PLAN_DELETED", "The routing plan was sucessfully deleted." }, { "OSMSG_PLAN_NOT_FOUND", "There is no routing plan called '%s'." }, @@ -308,6 +308,7 @@ static const struct message_entry msgtab[] = { { "OSMSG_COULDNT_FIND_SERVER", "Couldnt find %s, so using %s to link %s" }, { "OSMSG_INSPECTING_SERVER", "Inspecting server [%s]" }, { "OSMSG_REROUTING_ACC_MAP", "Rerouting network according to loaded map.." }, + { "OSMSG_REROUTING_NOTCONFIGURED", "You have not configured routing. See $/msg $O help routing$b." }, { "OSMSG_CONNECTING_MISSING_ONLY", "Connecting missing servers only.." }, { "OSMSG_NO_ROUTING_NECESSARY", "No rerouting appears necessary." }, { "OSMSG_TESTING_REROUTE", "Testing Reroute(): Commands not sent to socket.." }, @@ -2435,30 +2436,6 @@ free_routing_plan(void *data) free(rp); } -/* ************************************************************************ - * Auto Routing Plans - * ************************************************************************ - * - * XXX: routing plan TODO work - * - * DONE - * - read from .db into opserv_routing_plans. format: - * - write back to .db - * - show (stats routingplans?) - * - cmd_routing_addplan - * - cmd_routing_delplan - * - cmd_routing_addserver - * - cmd_routing_delserver - * - cmd_routing_set - * - cmd_reroute ( c / n / t ) - * - routing map - * TODO - * - timer after attempting a connect, - * to see if it timed out. - * ************************************************************************ - */ - - /************************************************* * Functions to handle the active routing struct */ @@ -2803,8 +2780,8 @@ routing_connect_one(struct route *route, char *server) return 0; /* its uplink isnt here to link to */ } } - log_module(MAIN_LOG, LOG_ERROR, "Tried to link %s but its not in the active routing struct!", server); - return 0; /* server wasnt found in active route struct ?! */ + log_module(MAIN_LOG, LOG_DEBUG, "Tried to link %s but its not in the active routing struct!", server); + return 0; /* server wasnt found in active route struct. */ } int routing_connect_children(struct route *route, char *server) @@ -2835,6 +2812,10 @@ int reroute(struct route *route, struct userNode *user, struct svccmd *cmd, char int connect = 0, move = 0, missing = 0, i; char d = toupper(*directive); + if(!route || !route->servers) { + reply("OSMSG_REROUTING_NOTCONFIGURED"); + return 0; + } if(user) { if(d == 'N') { /* normal */ irc_wallops("%s", "Attempting a reroute of the network according to loaded map..."); @@ -3136,6 +3117,9 @@ routing_handle_connect_failure(struct server *source, char *server, char *messag activate_routing(NULL, NULL, NULL); /* attempt to link it again. */ routing_connect_one(opserv_route, server); + /* TODO: reconnect any missing servers who + * normally connect to server, using their backups. + * Probably should just issue a reroute C here. */ } } }