summaryrefslogtreecommitdiff
path: root/plugins/FavContacts/src/cserver.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-08 12:14:56 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-08 12:14:56 +0000
commitac13aa1584ca595da727308406c87ec1bd9f5a21 (patch)
tree2cbda67ad0e66eec4614643c6b0a91f2584c4484 /plugins/FavContacts/src/cserver.cpp
parentabebf2658d6cb4c879f0952b77a576733494c96f (diff)
FavContacts:
- broken group functionality restored; - metacontacts support (patch by bio); - built-in http server wiped out; - optimized memory usage; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@9730 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FavContacts/src/cserver.cpp')
-rw-r--r--plugins/FavContacts/src/cserver.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/plugins/FavContacts/src/cserver.cpp b/plugins/FavContacts/src/cserver.cpp
deleted file mode 100644
index 881f84cec2..0000000000
--- a/plugins/FavContacts/src/cserver.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "headers.h"
-
-void CServer::Start(int port, IConnectionProcessorFactory *connectionProcessorFactory, bool background)
-{
- m_socket = socket(AF_INET, SOCK_STREAM, 0);
- if (m_socket == INVALID_SOCKET) return;
-
- sockaddr_in addr = { 0 };
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- addr.sin_port = htons((WORD)port);
- if (bind(m_socket, (sockaddr *)&addr, sizeof(addr)) == SOCKET_ERROR) {
- closesocket(m_socket);
- m_socket = INVALID_SOCKET;
- return;
- }
-
- listen(m_socket, SOMAXCONN);
-
- m_connectionProcessorFactory = connectionProcessorFactory;
-
- if (background)
- mir_forkthread(GlobalConnectionAcceptThread, this);
- else
- ConnectionAcceptThread();
-}
-
-void CServer::Stop()
-{
- shutdown(m_socket, SD_BOTH);
- closesocket(m_socket);
-}
-
-DWORD CServer::ConnectionAcceptThread()
-{
- while (1) {
- SOCKET s = accept(m_socket, NULL, NULL);
- if (s == INVALID_SOCKET) break;
-
- mir_forkthread(GlobalConnectionProcessThread, new GlobalConnectionProcessThreadArgs(this, s));
- }
- return 0;
-}
-
-DWORD CServer::ConnectionProcessThread(SOCKET s)
-{
- CSocket sock(s);
- IConnectionProcessor *processor = m_connectionProcessorFactory->Create(&sock);
- processor->ProcessConnection();
- delete processor;
- return 0;
-}
-
-void CServer::GlobalConnectionAcceptThread(void *arg)
-{
- CServer *server = (CServer *)arg;
- server->ConnectionAcceptThread();
-}
-
-void CServer::GlobalConnectionProcessThread(void *arg)
-{
- GlobalConnectionProcessThreadArgs *args = (GlobalConnectionProcessThreadArgs *)arg;
- args->m_server->ConnectionProcessThread(args->m_socket);
- delete args;
-}