From c0124a9bc626734694ff320c3a94c7076ca26e0c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 21 Apr 2017 15:03:25 +0200 Subject: Introduce lowercase homeattr, update server last activity properly --- server.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server.c') diff --git a/server.c b/server.c index 13d72c8..22f6085 100644 --- a/server.c +++ b/server.c @@ -127,12 +127,15 @@ void server_setHomeAttribute(const char *server, const char *homeattribute) server_t *entry = server_create(server); if (entry == NULL || entry->sslContext != NULL) return; free((void*)entry->homeAttr.s); + free((void*)entry->homeAttrLower.s); entry->homeAttr.l = strlen(homeattribute); + entry->homeAttrLower.l = entry->homeAttr.l; + entry->homeAttr.s = strdup(homeattribute); char *tmp = strdup(homeattribute); - for (size_t i = 0; i < entry->homeAttr.l; ++i) { + for (size_t i = 0; i < entry->homeAttrLower.l; ++i) { tmp[i] = tolower(tmp[i]); } - entry->homeAttr.s = tmp; + entry->homeAttrLower.s = tmp; } void server_setFingerprint(const char *server, const char *fingerprint) @@ -440,6 +443,7 @@ BOOL server_send(epoll_server_t *server, const char *buffer, size_t len, const B server->kill = TRUE; return FALSE; } + server->lastActive = time(NULL); if (ret == (int)len) return TRUE; // Couldn't send everything, continue with buffering logic below if (ret > 0) { -- cgit v1.2.3-55-g7522