18 #ifndef SOCKET_SERVER_HPP
19 #define SOCKET_SERVER_HPP
23 #include <NdbThread.h>
26 extern "C" void* sessionThread_C(
void*);
27 extern "C" void* socketServerThread_C(
void*);
40 virtual void runSession(){}
41 virtual void stopSession(){ m_stop =
true; }
44 friend void* sessionThread_C(
void*);
49 m_thread_stopped(
false)
51 DBUG_ENTER(
"SocketServer::Session");
52 DBUG_PRINT(
"enter",(
"NDB_SOCKET: " MY_SOCKET_FORMAT,
53 MY_SOCKET_FORMAT_VALUE(m_socket)));
57 NDB_SOCKET_TYPE m_socket;
60 bool m_thread_stopped;
77 virtual void stopSessions(){}
91 static bool tryBind(
unsigned short port,
const char * intface = 0);
98 bool setup(
Service *,
unsigned short *port,
const char * pinterface = 0);
119 bool stopSessions(
bool wait =
false,
unsigned wait_timeout = 0);
121 void foreachSession(
void (*f)(
Session*,
void*),
void *data);
122 void checkSessions();
125 struct SessionInstance {
130 struct ServiceInstance {
132 NDB_SOCKET_TYPE m_socket;
138 unsigned m_maxSessions;
141 void checkSessionsImpl();
142 void startSession(SessionInstance &);
152 friend void* socketServerThread_C(
void*);
153 friend void* sessionThread_C(
void*);