clientClose.c
714 Bytes
#include <stdlib.h> /* for free() */
#include <unistd.h> /* for close() */
#include <sys/socket.h> /* for shutdown() */
#include <string.h> /* for memset and stuff */
#include "include/appConfig.h"
#include "include/client.h"
#include "include/monitor.h"
void clientClose(tClient * client)
{
if (0 != verbose) {
syslog(LOG_INFO, "closing socket for %s", client->remoteAddr);
}
/* close socket an remove from fd_set */
shutdown(client->socket, SHUT_RDWR);
close(client->socket);
/* free buffer */
free(client->buffer);
client->buffer = NULL;
client->socket = 0;
client->readPos = 0;
client->bufMult = 0;
memset(client->remoteAddr, 0, 16);
}