using namespace std;
#define BUFLEN 10000
-#define MAX_CONNS 5
static bool enableDebug = false; // set to true to print debug messages
RestInput::RestInput(LineInput *lineInput) : m_lineInput(lineInput)
{
m_data = (char*)malloc(BUFLEN);
- m_thread = new std::thread[MAX_CONNS];
m_threadCount = 0;
}
+RestInput::~RestInput()
+{
+ free(m_data);
+ close(m_sockfd);
+}
+
bool RestInput::init()
{
m_sockfd = socket(AF_INET, SOCK_STREAM, 0);
return;
}
int n = read(connfd, m_data, BUFLEN);
+ close(connfd);
if (n < 0) {
cerr << "Failed to read from socket" << endl;
return;