diff options
-rw-r--r-- | include/channels.h | 9 | ||||
-rw-r--r-- | src/botserv.c | 12 | ||||
-rw-r--r-- | src/channels.c | 6 | ||||
-rw-r--r-- | src/module.cpp | 1 | ||||
-rw-r--r-- | src/sockets.cpp | 2 |
5 files changed, 16 insertions, 14 deletions
diff --git a/include/channels.h b/include/channels.h index 33a376a20..12343b2a2 100644 --- a/include/channels.h +++ b/include/channels.h @@ -14,7 +14,8 @@ struct UserData UserData() { lastline = NULL; - last_use = time(NULL); + last_use = last_start = time(NULL); + lines = times = 0; } virtual ~UserData() { delete [] lastline; } @@ -34,11 +35,11 @@ struct UserData struct UserContainer { User *user; - UserData *ud; + UserData ud; Flags<ChannelModeName> *Status; - UserContainer(User *u) : user(u) { ud = new UserData; } - virtual ~UserContainer() { delete ud; } + UserContainer(User *u) : user(u) { } + virtual ~UserContainer() { } }; typedef std::list<UserContainer *> CUserList; diff --git a/src/botserv.c b/src/botserv.c index 5d4173d20..3f535783a 100644 --- a/src/botserv.c +++ b/src/botserv.c @@ -585,17 +585,17 @@ static UserData *get_user_data(Channel *c, User *u) time_t now = time(NULL); /* Checks whether data is obsolete */ - if (now - uc->ud->last_use > Config.BSKeepData) + if (now - uc->ud.last_use > Config.BSKeepData) { - if (uc->ud->lastline) - delete [] uc->ud->lastline; + if (uc->ud.lastline) + delete [] uc->ud.lastline; /* We should not free and realloc, but reset to 0 instead. */ - memset(uc->ud, 0, sizeof(UserData)); - uc->ud->last_use = now; + memset(&uc->ud, 0, sizeof(UserData)); + uc->ud.last_use = now; } - return uc->ud; + return &uc->ud; } } diff --git a/src/channels.c b/src/channels.c index 60deace17..62dfc797b 100644 --- a/src/channels.c +++ b/src/channels.c @@ -46,7 +46,7 @@ Channel::Channel(const std::string &name, time_t ts) this->bans = this->excepts = this->invites = NULL; this->bd = NULL; this->server_modetime = this->chanserv_modetime = 0; - this->server_modecount = this->chanserv_modecount = this->bouncy_modes = this->topic_sync = 0; + this->server_modecount = this->chanserv_modecount = this->bouncy_modes = this->topic_sync = this->topic_time = 0; this->ci = cs_findchan(this->name); if (this->ci) @@ -1138,8 +1138,8 @@ void get_channel_stats(long *nrec, long *memuse) { mem += sizeof(*it); mem += sizeof((*it)->ud); - if ((*it)->ud->lastline) - mem += strlen((*it)->ud->lastline) + 1; + if ((*it)->ud.lastline) + mem += strlen((*it)->ud.lastline) + 1; } for (bd = chan->bd; bd; bd = bd->next) { if (bd->mask) diff --git a/src/module.cpp b/src/module.cpp index 6aebd8644..70592112e 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -137,6 +137,7 @@ Module::~Module() } delete [] mhash->name; delete mhash; + break; } lastHash = mhash; } diff --git a/src/sockets.cpp b/src/sockets.cpp index 413b6873a..861cd26d8 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -371,7 +371,7 @@ void SocketEngine::Process() fd_set rfdset = ReadFDs, wfdset = WriteFDs, efdset = ReadFDs; timeval tval; - tval.tv_sec = 10; + tval.tv_sec = Config.ReadTimeout; tval.tv_usec = 0; int sresult = select(MaxFD + 1, &rfdset, &wfdset, &efdset, &tval); |