#include "sockqueue.h" SockQueue::SockQueue() { memset(&socks, 0, MAX_SOCK_QUEUE * sizeof(SOCKET)); current = 0; } SockQueue::~SockQueue() { for (int i = 0; i < MAX_SOCK_QUEUE; i++) if (socks[i] != 0) closesocket(socks[i]); } void SockQueue::add(SOCKET s) { if (socks[current] != 0) closesocket(socks[current]); socks[current++] = s; if (current == MAX_SOCK_QUEUE) current = 0; }