summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-13 17:10:33 +0200
committerSimon Rettberg2015-09-13 17:10:33 +0200
commit8d9dec8d649ac4ce8bef39f3f75f67adb58c33d5 (patch)
tree472f36b9bf4ace95d4582bccdba6782d321013a6
parentAdd dn to fake group (diff)
downloadldadp-8d9dec8d649ac4ce8bef39f3f75f67adb58c33d5.tar.gz
ldadp-8d9dec8d649ac4ce8bef39f3f75f67adb58c33d5.tar.xz
ldadp-8d9dec8d649ac4ce8bef39f3f75f67adb58c33d5.zip
Update connection timeout properly
-rw-r--r--server.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/server.c b/server.c
index 3dd69b5..a3e0893 100644
--- a/server.c
+++ b/server.c
@@ -400,7 +400,6 @@ 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) {
@@ -416,7 +415,10 @@ BOOL server_send(epoll_server_t *server, const char *buffer, size_t len, const B
// Finally append to buffer
memcpy(server->sendBuffer + server->sbFill, buffer, len);
server->sbFill += len;
- if (!cork) return server_haveOut(server);
+ if (!cork) {
+ server->lastActive = time(NULL);
+ return server_haveOut(server);
+ }
return TRUE;
}
@@ -453,7 +455,6 @@ static BOOL server_haveOut(epoll_server_t * const server)
return FALSE; // Closed
}
}
- server->lastActive = time(NULL);
server->sbPos += ret;
if (server->ssl != NULL) {
memmove(server->sendBuffer, server->sendBuffer + server->sbPos, server->sbFill - server->sbPos);
@@ -512,6 +513,7 @@ static BOOL server_ensureConnected(server_t *server)
printf("[Server] Sending bindrequest for shared connection failed for server %s\n", server->addr);
return FALSE;
}
+ con->lastActive = time(NULL);
return TRUE;
}