Refactored hbuf and sbuf in piler-smtp.c

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2020-12-28 20:39:43 +01:00
parent 1e6a4b22c1
commit 1288c9fed3

View File

@ -135,7 +135,6 @@ int main(int argc, char **argv){
int client_len = sizeof(struct sockaddr_storage);
ssize_t readlen;
struct sockaddr_storage client_address;
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
char readbuf[BIGBUFSIZE];
int efd;
@ -257,6 +256,10 @@ int main(int argc, char **argv){
}
}
char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
memset(hbuf, 0, sizeof(hbuf));
memset(sbuf, 0, sizeof(sbuf));
if(getnameinfo((struct sockaddr *)&client_address, client_len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0){
// 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