1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Finished the first cut. I assume it doesn't build yet.

This commit is contained in:
Patrick LeBlanc
2019-01-22 16:12:49 -06:00
parent 3d58581945
commit 88273bfc14
5 changed files with 219 additions and 5 deletions

View File

@ -10,6 +10,7 @@
#include <sys/socket.h>
#include <sys/un.h>
using namespace std;
namespace
{
@ -60,8 +61,11 @@ SocketPool::~SocketPool()
{
boost::mutex::scoped_lock(mutex);
for (int i = 0; i < allSockets.size(); i++)
::close(allSockets[i]);
while (!allSockets.empty()) {
int next = allSockets.front();
allSockets.pop_front();
::close(next);
}
::close(clientSocket)
}
@ -145,7 +149,7 @@ int SocketPool::send_recv(const messageqcpp::ByteStream &in, messageqcpp::ByteSt
}
returnSocket(sock);
return;
return 0;
}
int SocketPool::getSocket()
@ -159,7 +163,7 @@ int SocketPool::getSocket()
struct sockaddr_un addr;
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strcpy(&addr.sun_path[1], "storagemanager"); // abstract socket; this is intentional
strcpy(&addr.sun_path[0], storagemanager::socket_name);
ret = ::connect(tmp, &addr, sizeof(addr));
if (ret >= 0)
allSockets.push_back(ret);