You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

503 lines
17 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
7 years ago
​
​
​
2 years ago
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
7 years ago
​
7 years ago
​
​
​
​
​
​
​
7 years ago
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
3 years ago
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
7 years ago
2 years ago
7 years ago
​
​
​
​
​
​
​
​
​
2 years ago
7 years ago
​
​
​
​
​
​
​
​
​
2 years ago
7 years ago
​
2 years ago
7 years ago
​
​
7 years ago
​
​
​
12 months ago
​
7 years ago
1 year ago
7 years ago
2 years ago
​
1 year ago
​
​
1 year ago
​
12 months ago
​
7 years ago
12 months ago
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
2 years ago
​
7 years ago
2 years ago
7 years ago
​
7 years ago
2 years ago
2 years ago
​
​
​
​
1 year ago
2 years ago
​
​
​
​
2 years ago
​
2 years ago
​
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
​
2 years ago
2 years ago
​
7 years ago
​
2 years ago
7 years ago
2 years ago
7 years ago
​
​
​
7 years ago
​
​
​
​
  1. #include "netServer.h"
  2. //#include "../../App/3dSERVER/LRF_ClientHandler.h"
  3. #include "netClientHandler.h"
  4. #define LOG( X ) m_pLog->Log( "NS", this, X )
  5. #ifdef DEBUG
  6. #define LOG_ERROR( X ) {\
  7. char _tBfrErrMSG234[256];\
  8. sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\
  9. m_pLog->Log( "NS", this, _LOG_ERROR, _tBfrErrMSG234 );\
  10. }
  11. #else
  12. #define LOG_ERROR( X ) m_pLog->Log( "NS", this, _LOG_ERROR, X );
  13. #endif
  14. void signal_void_handler( int SIG ){
  15. };
  16. networkServer::networkServer( config_setting_t *Settings, networkServiceEngine *ptr ) : basicThread(){
  17. m_pLog = basicLogCollection::getInstance();
  18. m_bConnectionType = 0;
  19. m_vHandlersPool.clear();
  20. MainSocketAddress = NULL;
  21. m_pKernelEngine = ptr;
  22. MainSocket = INVALID_SOCKET;
  23. if( Settings != NULL ) {
  24. m_pSettings = Settings;
  25. } else {
  26. m_pSettings = basicSettingsProvider::getInstance()->getSubNode( NULL, "NETWORK_SERVER" );
  27. };
  28. };
  29. networkServer::~networkServer(){
  30. m_bThreadStatus = TH_ENDED;
  31. if( m_pHostName != NULL ) free( m_pHostName );
  32. };
  33. bool networkServer::BootUp( void ){
  34. config_setting_t *pSetting;
  35. int tVal;
  36. char tBuffer[CTEXT];
  37. m_pHostName = NULL;
  38. if( m_pSettings != NULL ) {
  39. LOG("NetServer Getting Settings ...");
  40. #ifdef AUTOMATIC_IP_DETECTION
  41. struct ifaddrs * ifaddr = NULL;
  42. struct ifaddrs * ifa;
  43. m_pHostName = (CSTR)malloc(CTEXT);
  44. if( -1 == getifaddrs(&ifaddr)) {
  45. LOG_ERROR("Cannot get Net Integfaces!");
  46. return false;
  47. } else {
  48. bool regs = false;
  49. char ip[16];
  50. struct sockaddr_in * inn;
  51. unsigned char A,B,C,D;
  52. #ifdef DEBUG
  53. LOG("Gotta check some IFs");
  54. #endif
  55. for( ifa = ifaddr; ifa; ifa = ifa->ifa_next ) {
  56. if( ifa->ifa_addr == NULL ){
  57. // Can Bus
  58. LOG("IFA->ifa_addr is NULL");
  59. continue;
  60. };
  61. if( ifa->ifa_addr->sa_family != AF_INET ) continue;
  62. inn = (struct sockaddr_in *)ifa->ifa_addr;
  63. D = ( inn->sin_addr.s_addr >> 24) & 0xFF;
  64. C = ( inn->sin_addr.s_addr >> 16) & 0xFF;
  65. B = ( inn->sin_addr.s_addr >> 8) & 0xFF;
  66. A = ( inn->sin_addr.s_addr >> 0) & 0xFF;
  67. sprintf( ip, "%d.%d.%d.%d", A, B, C, D );
  68. sprintf( tBuffer, "Network Interface: %s [%s]", ifa->ifa_name, ip );
  69. if( strncmp( ifa->ifa_name,"eth", 3) == 0 || strncmp( ifa->ifa_name,"enp", 3) == 0 ) {
  70. regs = true;
  71. sprintf( m_pHostName, ip );
  72. };
  73. LOG( tBuffer );
  74. };
  75. if(!regs) {
  76. free( m_pHostName );
  77. m_pHostName = NULL;
  78. LOG_ERROR("Ethernet IP address Not Detected! Using Settings");
  79. if( !config_setting_lookup_string( m_pSettings, NWS_SETTINGS_HOST, (const char**)&m_pHostName ) ){
  80. m_pHostName = (CSTR)malloc(CTEXT);
  81. sprintf( m_pHostName, "localhost" );
  82. pSetting = config_setting_add( m_pSettings, NWS_SETTINGS_HOST, CONFIG_TYPE_STRING );
  83. config_setting_set_string( pSetting, m_pHostName );
  84. basicSettingsProvider::getInstance()->compromise();
  85. LOG("No Host defined");
  86. } else {
  87. sprintf( tBuffer, "Host Address Read From Settings: %s", m_pHostName );
  88. LOG( tBuffer );
  89. };
  90. };
  91. freeifaddrs( ifaddr );
  92. };
  93. #else
  94. if( !config_setting_lookup_string( m_pSettings, NWS_SETTINGS_HOST, (const char**)&m_pHostName ) ){
  95. m_pHostName = (CSTR)malloc(CTEXT);
  96. sprintf( m_pHostName, "localhost" );
  97. pSetting = config_setting_add( m_pSettings, NWS_SETTINGS_HOST, CONFIG_TYPE_STRING );
  98. config_setting_set_string( pSetting, m_pHostName );
  99. basicSettingsProvider::getInstance()->compromise();
  100. LOG("No Host defined");
  101. } else {
  102. sprintf( tBuffer, "Host Address Read From Settings: %s", m_pHostName );
  103. LOG( tBuffer );
  104. };
  105. #endif
  106. if (!config_setting_lookup_int( m_pSettings, NWS_SETTINGS_PORT, &tVal )){
  107. m_nPortNumber = 2222;
  108. pSetting = config_setting_add( m_pSettings, NWS_SETTINGS_PORT, CONFIG_TYPE_INT);
  109. config_setting_set_int(pSetting, m_nPortNumber );
  110. basicSettingsProvider::getInstance()->compromise();
  111. LOG("No Port defined");
  112. } else {
  113. m_nPortNumber = tVal;
  114. sprintf( tBuffer, "Port Read From Settings: %d", m_nPortNumber );
  115. LOG( tBuffer );
  116. };
  117. sprintf( tBuffer, "Final Network Config is: %s:%d", m_pHostName, m_nPortNumber );
  118. LOG( tBuffer );
  119. if( basicSettingsProvider::getInstance()->isCompromised() ) basicSettingsProvider::getInstance()->validate();
  120. return BootUp( m_pHostName, m_nPortNumber );
  121. } else {
  122. // Last try to bootup by detecting host and default port 2222
  123. return BootUp( 2222 );
  124. };
  125. };
  126. bool networkServer::BootUp( CSTR HOST_NAME, U16 PORT ){
  127. char temp[CTEXT];
  128. int RetCode;
  129. #ifdef __linux__
  130. struct hostent *h_info;
  131. #ifdef DEBUG
  132. LOG( "BootUp" );
  133. #endif
  134. MainSocket = socket( AF_INET, SOCK_STREAM, 0 );
  135. if( MainSocket == -1){
  136. LOG_ERROR( "Some throuble with networking on this machine (Socket Error)!");
  137. return false;
  138. };
  139. const int enable = 1;
  140. if( setsockopt( MainSocket, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(int)) < 0 ){
  141. LOG_ERROR("setsockopt(SO_REUSEADDR) failed");
  142. };
  143. MainSocketAddress = NULL;
  144. MainSocketAddress = ( struct sockaddr * ) malloc( sizeof( struct sockaddr_in ) );
  145. if( MainSocketAddress == NULL ){
  146. LOG_ERROR( "Some throuble with networking on this machine (Cannot Alloc Sockaddr Struct)!" );
  147. return false;
  148. };
  149. bzero( MainSocketAddress, sizeof( struct sockaddr_in ) );
  150. h_info = gethostbyname ( HOST_NAME );
  151. if ( h_info == NULL ){
  152. LOG_ERROR( "Some throuble with networking on this machine (Cannot Get Hostname)!" );
  153. return false;
  154. };
  155. //*****************************************
  156. //* there we building our network address *
  157. //*****************************************
  158. bcopy( h_info->h_addr, &(((struct sockaddr_in *)MainSocketAddress)->sin_addr), h_info->h_length );
  159. ((struct sockaddr_in *)MainSocketAddress)->sin_family = h_info->h_addrtype;
  160. ((struct sockaddr_in *)MainSocketAddress)->sin_port = htons( PORT );
  161. RetCode = bind( MainSocket , MainSocketAddress, sizeof( struct sockaddr_in ) );
  162. if ( RetCode != 0 ){
  163. LOG_ERROR( "Error Binding to Port/Address" );
  164. return false;
  165. };
  166. RetCode = listen( MainSocket, 128);
  167. if ( RetCode != 0 ){
  168. LOG_ERROR( "Cannot Listen Port/Address" );
  169. return false;
  170. };
  171. int flags;
  172. flags = fcntl( MainSocket, F_GETFL, NULL );
  173. flags |= O_NONBLOCK | O_NDELAY;
  174. //RetCode = ioctl( MainSocket, FIONBIO, (char *) &dontblock );
  175. RetCode = fcntl( MainSocket, F_SETFL, flags );
  176. if ( RetCode == 0 ){
  177. LOG( "Set N-Blocking Mode of Accepting Socket" );
  178. } else {
  179. LOG( "Can't set N-Blocking Mode of Accepting Socket" );
  180. };
  181. #else
  182. WSADATA wsaData;
  183. int iResult;
  184. // Initialize Winsock
  185. iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
  186. if( iResult != 0 ){
  187. sprintf(temp, "WSAStartup failed with error: %d\n", iResult);
  188. LOG_ERROR(temp);
  189. return false;
  190. };
  191. MainSocket = INVALID_SOCKET;
  192. SOCKET ClientSocket = INVALID_SOCKET;
  193. struct addrinfo *result = NULL;
  194. struct addrinfo hints;
  195. int iSendResult;
  196. char recvbuf[512];
  197. int recvbuflen = 512;
  198. ZeroMemory(&hints, sizeof(hints));
  199. hints.ai_family = AF_INET;
  200. hints.ai_socktype = SOCK_STREAM;
  201. hints.ai_protocol = IPPROTO_TCP;
  202. hints.ai_flags = AI_PASSIVE;
  203. // Resolve the server address and port
  204. sprintf( temp, "%d", PORT );
  205. iResult = getaddrinfo(NULL, temp, &hints, &result);
  206. if (iResult != 0) {
  207. sprintf( temp, "getaddrinfo failed with error: %d\n", iResult );
  208. LOG_ERROR(temp);
  209. WSACleanup();
  210. return false;
  211. };
  212. // Create a SOCKET for connecting to server
  213. MainSocket = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
  214. if (MainSocket == INVALID_SOCKET) {
  215. sprintf( temp, "socket failed with error: %ld\n", WSAGetLastError() );
  216. LOG_ERROR(temp);
  217. freeaddrinfo(result);
  218. WSACleanup();
  219. return false;
  220. };
  221. // Setup the TCP listening socket
  222. iResult = bind(MainSocket, result->ai_addr, (int)result->ai_addrlen);
  223. if (iResult == SOCKET_ERROR) {
  224. sprintf( temp, "bind failed with error: %d\n", WSAGetLastError());
  225. LOG_ERROR(temp);
  226. freeaddrinfo(result);
  227. closesocket(MainSocket);
  228. WSACleanup();
  229. return false;
  230. };
  231. freeaddrinfo(result);
  232. iResult = listen(MainSocket, SOMAXCONN);
  233. if (iResult == SOCKET_ERROR) {
  234. sprintf( temp, "listen failed with error: %d\n", WSAGetLastError());
  235. LOG_ERROR(temp);
  236. closesocket(MainSocket);
  237. WSACleanup();
  238. return false;
  239. };
  240. #endif
  241. m_bConnectionType = 1;
  242. return init();
  243. };
  244. bool networkServer::BootUp( U16 Port ){
  245. char temp[CTEXT];
  246. m_nPortNumber = Port;
  247. #ifdef __linux__
  248. int RetCode;
  249. size_t S_NAMLEN = CTEXT;
  250. RetCode = gethostname( m_pHostName, S_NAMLEN );
  251. sprintf( temp, "Running on host: %s:%d", m_pHostName, m_nPortNumber );
  252. LOG( temp );
  253. #else
  254. sprintf( m_pHostName, "" );
  255. #endif
  256. return BootUp( m_pHostName, m_nPortNumber );
  257. };
  258. bool networkServer::attachEngine( networkServiceEngine *ptr ){
  259. m_pKernelEngine = ptr;
  260. if( m_vHandlersPool.size()) {
  261. // Pass Kernel to all already connected nodes
  262. for( vectorNetHandlers::iterator index = m_vHandlersPool.begin(); index < m_vHandlersPool.end(); index++ ) {
  263. //((LRF_ClientHandler *)(*index))->attachEngine(m_pDetectorKernel);
  264. (*index)->attachEngine( m_pKernelEngine );
  265. };
  266. };
  267. return true;
  268. };
  269. #ifdef __linux__
  270. bool networkServer::BootUp(CSTR SOCKET_NAME){
  271. struct sockaddr_un MainPort;
  272. size_t S_NAMLEN = CTEXT;
  273. int RetCode;
  274. char localhost[S_NAMLEN];
  275. char temp[CTEXT];
  276. LOG( "Core BootUp" );
  277. MainSocket = socket( PF_UNIX, SOCK_STREAM, 0 );
  278. if( MainSocket == -1){
  279. LOG_ERROR( "Some throuble with Kernel on this machine (UnixSocket Error)!" );
  280. return false;
  281. };
  282. if( unlink( SOCKET_NAME ) == -1 ){
  283. LOG( "Old Socket File was not deleted!" );
  284. };
  285. localhost[0] = 0;
  286. //RetCode = gethostname( localhost, S_NAMLEN );
  287. sprintf( temp, "Running Unix Socket: %s::%s", localhost, SOCKET_NAME );
  288. LOG( temp );
  289. MainSocketAddress = ( sockaddr *) malloc( sizeof( struct sockaddr_un ) );
  290. bzero( MainSocketAddress, sizeof( struct sockaddr_un ) );
  291. //*****************************************
  292. //* there we building our network address *
  293. //*****************************************
  294. ((struct sockaddr_un *) MainSocketAddress )->sun_family = AF_UNIX;
  295. snprintf( ((struct sockaddr_un *) MainSocketAddress )->sun_path, UNIX_PATH_MAX, SOCKET_NAME );
  296. RetCode = bind( MainSocket , MainSocketAddress, sizeof( struct sockaddr_un ) );
  297. if ( RetCode != 0 ){
  298. LOG_ERROR( "Error Binding to Port/Address" );
  299. return false;
  300. };
  301. RetCode = listen( MainSocket, 128);
  302. if ( RetCode != 0 ){
  303. LOG_ERROR( "Cannot Listen UNIX SOCKET" );
  304. return false;
  305. };
  306. U8 dontblock;
  307. // Set Socket permitions 666
  308. fchmod( MainSocket, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH );
  309. dontblock = fcntl( MainSocket, F_GETFL, NULL );
  310. dontblock |= O_NONBLOCK | O_NDELAY;
  311. RetCode = ioctl( MainSocket, FIONBIO, (char *) &dontblock );
  312. if (RetCode == 0 ){
  313. LOG( "Set N-Blocking Mode of Master Socket" );
  314. } else {
  315. LOG( "Can't set N-Blocking Mode of Master Socket" );
  316. };
  317. m_bConnectionType = 2;
  318. return init();
  319. };
  320. #endif
  321. void networkServer::m_fThreadProc( void ){
  322. struct sockaddr ClientAddress;
  323. socklen_t size;
  324. int RetCode;
  325. #ifdef __linux__
  326. int ClientSocket;
  327. if( m_bConnectionType == 1 ){
  328. size = (socklen_t) sizeof( struct sockaddr_in );
  329. } else {
  330. size = (socklen_t) sizeof( struct sockaddr_un );
  331. };
  332. #else
  333. SOCKET ClientSocket;
  334. #endif
  335. #ifdef DEBUG
  336. LOG( "Core Worker Thread Started" );
  337. LOG( "Ready to Accept Connections" );
  338. #endif
  339. m_bThreadStatus = TH_WORKING;
  340. while (m_bThreadStatus < TH_ENDED ){
  341. ClientSocket = accept ( MainSocket, &ClientAddress, &size );
  342. if ( ClientSocket < 0 ) {
  343. switch( errno ){
  344. case EAGAIN:{
  345. // Checkup client disconnection
  346. if( m_vHandlersPool.size()) {
  347. for( vectorNetHandlers::iterator index = m_vHandlersPool.begin(); index < m_vHandlersPool.end(); ) {
  348. //LRF_ClientHandler *tClient = (LRF_ClientHandler *)(*index);
  349. if( (*index)->getStatus() == false ){
  350. // Remove Client Handler
  351. #ifdef DEBUG_EXTRA
  352. LOG("Remove Client");
  353. #endif
  354. if( m_pKernelEngine ){
  355. if ( m_pKernelEngine->detachClient( (*index) ) ){
  356. #ifdef DEBUG_EXTRA
  357. LOG("Client Stoped");
  358. #endif
  359. m_vHandlersPool.erase( index );
  360. #ifdef DEBUG_EXTRA
  361. LOG("Remove Client Done");
  362. #endif
  363. continue;
  364. } else LOG_ERROR("Client detach from Kernel Failure!");
  365. } else LOG_ERROR("No Kernel Attached!");
  366. };
  367. index++;
  368. };
  369. };
  370. SLEEP(10);
  371. continue;
  372. };
  373. //case EWOULDBLOCK: me->Log(" The socket is marked non-blocking and no connections are present to be accepted."); break;
  374. case EBADF: LOG_ERROR( "The descriptor is invalid." ); break;
  375. case ECONNABORTED: LOG_ERROR( "A connection has been aborted."); break;
  376. case EINTR: LOG_ERROR( "The system call was interrupted by a signal that was caught before a valid connection arrived."); break;
  377. case EINVAL: LOG_ERROR( "Socket is not listening for connections, or addrlen is invalid (e.g., is negative)."); break;
  378. case EMFILE: LOG_ERROR( "The per-process limit of open file descriptors has been reached."); break;
  379. case ENFILE: LOG_ERROR( "The system limit on the total number of open files has been reached."); break;
  380. case ENOTSOCK: LOG_ERROR( "The descriptor references a file, not a socket."); break;
  381. case EOPNOTSUPP: LOG_ERROR( "The referenced socket is not of type SOCK_STREAM."); break;
  382. case EFAULT: LOG_ERROR( "The addr argument is not in a writable part of the user address space."); break;
  383. case ENOBUFS:
  384. case ENOMEM: LOG_ERROR( "Not enough free memory. This often means that the memory allocation is limited by the socket buffer limits, not by the system memory."); break;
  385. case EPROTO: LOG_ERROR( "Protocol error."); break;
  386. case EPERM: LOG_ERROR( "Firewall rules forbid connection."); break;
  387. case ENOSR:
  388. #ifdef __linux__
  389. case ESOCKTNOSUPPORT:
  390. #endif
  391. case EPROTONOSUPPORT:
  392. case ETIMEDOUT: LOG_ERROR( " Unusual error in Kernel (Timeout, No Socket Support in Kernel, Unsupported Protocol)"); break;
  393. //case ERESTARTSYS: me->Log(" Unusual error by Kernel"); break;
  394. default: LOG_ERROR( " Unhandled error in Kernel"); break;
  395. };
  396. m_bThreadStatus = TH_ENDED;
  397. } else {
  398. /*
  399. if( m_bConnectionType == 1 ){
  400. char tstr[CQUERY];
  401. #ifdef __linux__
  402. inet_ntop( AF_INET, &(((struct sockaddr_in*) &(ClientAddress ))->sin_addr ), tstr, CQUERY );//size );
  403. #else
  404. strcpy( tstr, inet_ntoa( ((struct sockaddr_in*)&ClientAddress)->sin_addr ) );
  405. //InetNtop(AF_INET, &(((struct sockaddr_in*) &(ClientAddress ))->sin_addr ), tstr, size );
  406. #endif
  407. };
  408. */
  409. int flags;
  410. flags = fcntl( ClientSocket, F_GETFL, NULL );
  411. flags |= O_NONBLOCK | O_NDELAY;
  412. //RetCode = ioctl( MainSocket, FIONBIO, (char *) &dontblock );
  413. RetCode = fcntl( ClientSocket, F_SETFL, flags );
  414. #ifdef DEBUG_EXTRA
  415. if ( RetCode == 0 ){
  416. LOG( "Set N-Blocking Mode of Client Socket" );
  417. } else {
  418. LOG( "Can't set N-Blocking Mode of Client Socket" );
  419. };
  420. LOG( "Client Connection Accepted" );
  421. #endif
  422. if( m_pKernelEngine ) {
  423. networkClientHandler *tHandle;
  424. #ifdef DEBUG
  425. LOG("Before New Handler");
  426. #endif
  427. tHandle = m_pKernelEngine->attachNewClient( ClientSocket, &ClientAddress );
  428. #ifdef DEBUG
  429. LOG("After New Handler");
  430. #endif
  431. if( tHandle != NULL ) {
  432. #ifdef DEBUG_EXTRA
  433. LOG("Handle Not NULL");
  434. #endif
  435. //tHandle->attachEngine( m_pKernelEngine );
  436. m_vHandlersPool.push_back( tHandle );
  437. } else {
  438. #ifdef DEBUG
  439. LOG_ERROR("No Client Handler Created!");
  440. #endif
  441. shutdown( ClientSocket, 2 );
  442. close( ClientSocket );
  443. };
  444. } else {
  445. #ifdef DEBUG
  446. LOG_ERROR("No Kernel Attached!");
  447. #endif
  448. shutdown( ClientSocket, 2 );
  449. close( ClientSocket );
  450. };
  451. };
  452. };
  453. #ifdef DEBUG
  454. LOG( "Core Worker Thread Ended" );
  455. #endif
  456. };
  457. bool networkServer::dispatchEvent( EVENT_CONTAINER *Evt ){
  458. if( Evt == NULL ) return false;
  459. return true;
  460. };
  461. #undef LOG
  462. #undef LOG_ERROR