00001 #include <stdlib.h>
00002 #include <unistd.h>
00003 #include <sys/socket.h>
00004 #include <string.h>
00005
00006 #include <expat.h>
00007
00008 #include "../../include/client.h"
00009 #include "../../include/monitor.h"
00010 #include "../../include/httpRequest.h"
00011
00012 void clientClose(tClient * client)
00013 {
00014 if (0 != verbose) {
00015 syslog(LOG_INFO, "closing socket for %s", client->remoteAddr);
00016 }
00017
00018
00019 shutdown(client->socket, SHUT_RDWR);
00020 close(client->socket);
00021
00022
00023 if (NULL != client->readBuffer) {
00024 free(client->readBuffer);
00025 client->readBuffer = NULL;
00026 }
00027 if (NULL != client->writeBuffer) {
00028 free(client->writeBuffer);
00029 client->writeBuffer = NULL;
00030 }
00031 client->readPos = 0;
00032 client->writePos = 0;
00033
00034 freeHttpHeader(&(client->httpHeader));
00035
00036 XML_ParserFree(client->parser);
00037
00038 memset(client->remoteAddr, 0, 16);
00039 }