src: improved sessin logging

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2017-11-04 15:34:34 +01:00
parent c96693f98f
commit 20d41eb261
2 changed files with 4 additions and 2 deletions

View File

@ -234,7 +234,9 @@ int main(int argc, char **argv){
}
if(getnameinfo((struct sockaddr *)&client_address, client_len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0){
syslog(LOG_PRIORITY, "connected from %s:%s on descriptor %d", hbuf, sbuf, client_sockfd);
// Strictly speaking it's not correct to log num_connections+1 connections
// but it still gives a good clue how many connections we have at the moment
syslog(LOG_PRIORITY, "connected from %s:%s on descriptor %d (active connections: %d)", hbuf, sbuf, client_sockfd, num_connections + 1);
}
if(make_socket_non_blocking(client_sockfd) == -1){

View File

@ -151,7 +151,7 @@ void free_smtp_session(struct smtp_session *session){
void tear_down_session(struct smtp_session **sessions, int slot, int *num_connections){
syslog(LOG_PRIORITY, "disconnected from %s", sessions[slot]->remote_host);
syslog(LOG_PRIORITY, "disconnected from %s on descriptor %d (%d active connections)", sessions[slot]->remote_host, sessions[slot]->net.socket, (*num_connections)-1);
close(sessions[slot]->net.socket);