X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2Fstats.mod%2Fmodule.c;h=e322754ab017e96f755c0268a152dbd361878282;hb=2278ae0efc3249c54509d969bdf863dc658dfa49;hp=fa7d2011bea206d1509693fb12967ef65297b10c;hpb=70b7d70a96523b78cd470c6fe2ab78beb345d607;p=NeonServV5.git diff --git a/src/modules/stats.mod/module.c b/src/modules/stats.mod/module.c index fa7d201..e322754 100644 --- a/src/modules/stats.mod/module.c +++ b/src/modules/stats.mod/module.c @@ -1,4 +1,4 @@ -/* module.c - NeonServ v5.5 +/* module.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -94,7 +94,7 @@ static TIMEQ_CALLBACK(stats_timer_callback) { if(get_int_field(tmp)) pkgpos += sprintf(pkgbuf + pkgpos, "*\n"); else { - struct ClientSocket *bot, *bot1, *bot2, *bot3; + struct ClientSocket *bot, *bot1 = NULL, *bot2 = NULL, *bot3 = NULL; for(bot = getBots(SOCKET_FLAG_READY, NULL); bot; bot = getBots(SOCKET_FLAG_READY, bot)) { if(bot->botid == 1 && (bot->flags & SOCKET_FLAG_PREFERRED)) bot1 = bot; @@ -143,20 +143,21 @@ static TIMEQ_CALLBACK(stats_timer_callback) { if (!host) return; si_other.sin_addr = *(struct in_addr*)host->h_addr; } + sendto(sock, pkgbuf, pkgpos, 0, &si_other, sizeof(si_other)); #else struct sockaddr_in si_other; int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); if (sock == -1) return; si_other.sin_family = AF_INET; si_other.sin_port = htons(STATS_UPDATE_PORT); - si_other.sin_addr.s_addr = inet_addr(client->host); + si_other.sin_addr.s_addr = inet_addr(STATS_UPDATE_HOST); if (si_other.sin_addr.s_addr == INADDR_NONE) { - struct hostent *host = gethostbyname(client->host); + struct hostent *host = gethostbyname(STATS_UPDATE_HOST); if(!host) return; memcpy(&(si_other.sin_addr), host->h_addr_list[0], 4); } + sendto(sock, pkgbuf, pkgpos, 0, (struct sockaddr *) &si_other, sizeof(si_other)); #endif - sendto(sock, pkgbuf, pkgpos, 0, &si_other, sizeof(si_other)); close(sock); }