| 1 |
/* |
| 2 |
* Component of the D-ITG 2.8.1 (r1023) platform (http://traffic.comics.unina.it/software/ITG) |
| 3 |
* |
| 4 |
* Copyright : (C) 2004-2013 by Alessio Botta, Walter de Donato, Alberto Dainotti, |
| 5 |
* Stefano Avallone, Antonio Pescape' (PI) |
| 6 |
* COMICS (COMputer for Interaction and CommunicationS) Group |
| 7 |
* Department of Electrical Engineering and Information Technologies |
| 8 |
* University of Napoli "Federico II". |
| 9 |
* email : [email protected], [email protected], [email protected], |
| 10 |
* [email protected], [email protected] |
| 11 |
* |
| 12 |
* This program is free software: you can redistribute it and/or modify |
| 13 |
* it under the terms of the GNU General Public License as published by |
| 14 |
* the Free Software Foundation, either version 3 of the License, or |
| 15 |
* (at your option) any later version. |
| 16 |
* |
| 17 |
* This program is distributed in the hope that it will be useful, |
| 18 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
* GNU General Public License for more details. |
| 21 |
* |
| 22 |
* You should have received a copy of the GNU General Public License |
| 23 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 24 |
* |
| 25 |
* For commercial use please refer to D-ITG Professional. |
| 26 |
*/ |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#include "../common/ITG.h" |
| 32 |
#include "../common/debug.h" |
| 33 |
#include "../common/thread.h" |
| 34 |
#include "../common/timestamp.h" |
| 35 |
#include "ITGLog.h" |
| 36 |
#include "channel.h" |
| 37 |
|
| 38 |
#ifdef WIN32 |
| 39 |
char nameProgram[]="ITGLog"; |
| 40 |
#endif |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
struct manageLogFile{ |
| 46 |
ofstream out; |
| 47 |
int num; |
| 48 |
char logFile[DIM_LOG_FILE]; |
| 49 |
}; |
| 50 |
|
| 51 |
|
| 52 |
ofstream out; |
| 53 |
|
| 54 |
|
| 55 |
int flagTerm = 0; |
| 56 |
|
| 57 |
uint16_t logbuffer_size = 50; |
| 58 |
|
| 59 |
|
| 60 |
signaling signalingLog; |
| 61 |
|
| 62 |
|
| 63 |
struct sockaddr_in senderLog; |
| 64 |
|
| 65 |
|
| 66 |
int signalSocket = 0; |
| 67 |
|
| 68 |
|
| 69 |
manageLogFile memLogFile[MAX_NUM_THREAD]; |
| 70 |
|
| 71 |
|
| 72 |
#ifdef UNIX |
| 73 |
const char DEFAULT_LOG_FILE[] = "/tmp/ITGLog.log"; |
| 74 |
|
| 75 |
pthread_mutex_t mutexLog; |
| 76 |
pthread_mutex_t mutexLogPort; |
| 77 |
#endif |
| 78 |
|
| 79 |
#ifdef WIN32 |
| 80 |
const char DEFAULT_LOG_FILE[] = "ITGLog.log"; |
| 81 |
|
| 82 |
HANDLE mutexLog; |
| 83 |
#endif |
| 84 |
|
| 85 |
void* waitStopKey(void* s) |
| 86 |
{ |
| 87 |
#ifdef WIN32 |
| 88 |
Sleep(1000); |
| 89 |
#endif |
| 90 |
PRINTD(1, "waitStopKey: Waiting for the stop key\n"); |
| 91 |
while (getchar() != 'C') {} |
| 92 |
printf("Terminated by request\n"); |
| 93 |
terminate(0); |
| 94 |
return NULL; |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
#ifdef UNIX |
| 101 |
# define EXEC_NAME "./ITGLog " |
| 102 |
#endif |
| 103 |
#ifdef WIN32 |
| 104 |
# define EXEC_NAME "ITGLog.exe" |
| 105 |
#endif |
| 106 |
void printHelpAndExit() |
| 107 |
{ |
| 108 |
cout << "\nITGLog - Remote Log Server Component of D-ITG platform\n"; |
| 109 |
|
| 110 |
cout << "\n Synopsis\n\n" |
| 111 |
|
| 112 |
" "<<EXEC_NAME<<" [options]\n"; |
| 113 |
|
| 114 |
cout << "\n Options\n\n" |
| 115 |
" -h | --help Display this help and exit\n\n" |
| 116 |
|
| 117 |
" -q <log_buffer_size> Number of packets to push to the log at once (default: " << logbuffer_size << ")\n"; |
| 118 |
|
| 119 |
cout << "\nFor more information please refer to the manual.\n"; |
| 120 |
|
| 121 |
exit(1); |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
void recvInfo(int signalingChannel, BYTE &protocol, char logFile[DIM_LOG_FILE]) |
| 126 |
{ |
| 127 |
|
| 128 |
BYTE buffer = LOG_CONNECT; |
| 129 |
int size_r; |
| 130 |
|
| 131 |
if ( sendto(signalingChannel, (const char *) &buffer, sizeof(BYTE), 0, |
| 132 |
(struct sockaddr *) &senderLog, sizeof(senderLog)) < 0) |
| 133 |
reportErrorAndExit("recvInfo","sendto","Cannot send buffer"); |
| 134 |
PRINTD(1,"recvInfo: Sent LOG_CONNECT message\n"); |
| 135 |
|
| 136 |
|
| 137 |
if ( (size_r = recv(signalingChannel, (char *) &signalingLog, sizeof(signalingLog), 0)) < 0) |
| 138 |
reportErrorAndExit("recvInfo","recv","Cannot receive signalingLog data"); |
| 139 |
PRINTD(1,"recvInfo: Received infos on log activity\n"); |
| 140 |
|
| 141 |
|
| 142 |
protocol = signalingLog.protocol; |
| 143 |
strcpy(logFile, signalingLog.logFile); |
| 144 |
printf("Name Log File : %s \n", logFile); |
| 145 |
printf("Protocol used : %s \n", invFindL4Proto(protocol)); |
| 146 |
fflush(stdout); |
| 147 |
|
| 148 |
} |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
char *allowedLogFile(char logFile[DIM_LOG_FILE]) |
| 153 |
{ |
| 154 |
int i = 0; |
| 155 |
|
| 156 |
bool find = true; |
| 157 |
|
| 158 |
while ((i < MAX_NUM_THREAD) && (find == true)) { |
| 159 |
if (strcmp(memLogFile[i].logFile, logFile) == 0) { |
| 160 |
|
| 161 |
find = false; |
| 162 |
|
| 163 |
memLogFile[i].num++; |
| 164 |
return (char *) &memLogFile[i].out; |
| 165 |
} else |
| 166 |
i++; |
| 167 |
} |
| 168 |
i = 0; |
| 169 |
|
| 170 |
while (memLogFile[i].num != -1) |
| 171 |
i++; |
| 172 |
|
| 173 |
memLogFile[i].out.open(logFile, ios::out | ios::binary | ios::trunc); |
| 174 |
if (!memLogFile[i].out) { |
| 175 |
|
| 176 |
char* tail = (char *) malloc(sizeof("Error into open this file : ") + sizeof(logFile)); |
| 177 |
if (tail == NULL) |
| 178 |
reportErrorAndExit("allowedLogFile","malloc","Insifficient memory available"); |
| 179 |
|
| 180 |
sprintf(tail,"Error into open this file : %s",logFile); |
| 181 |
reportErrorAndExit("allowedLogFile","open",tail); |
| 182 |
} |
| 183 |
|
| 184 |
memLogFile[i].num = 1; |
| 185 |
strcpy(memLogFile[i].logFile, logFile); |
| 186 |
return (char *) &memLogFile[i].out; |
| 187 |
} |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
void closeFileLog(ofstream * out) |
| 193 |
{ |
| 194 |
int i = 0; |
| 195 |
|
| 196 |
while (out != (ofstream *) & memLogFile[i].out) |
| 197 |
i++; |
| 198 |
|
| 199 |
memLogFile[i].num--; |
| 200 |
if (memLogFile[i].num == 0) { |
| 201 |
|
| 202 |
memLogFile[i].num = -1; |
| 203 |
|
| 204 |
(*out).close(); |
| 205 |
strcpy(memLogFile[i].logFile, " "); |
| 206 |
} |
| 207 |
} |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
int findPortFree(int logSock) |
| 212 |
{ |
| 213 |
|
| 214 |
int exit = 1; |
| 215 |
|
| 216 |
int randomPort; |
| 217 |
|
| 218 |
int numTries; |
| 219 |
|
| 220 |
struct sockaddr_in sockAddress; |
| 221 |
|
| 222 |
sockAddress.sin_family = AF_INET; |
| 223 |
|
| 224 |
sockAddress.sin_addr.s_addr = htonl(INADDR_ANY); |
| 225 |
numTries = 0; |
| 226 |
setSeedRandom(); |
| 227 |
do { |
| 228 |
|
| 229 |
randomPort = rand() % OFFSET_LOG_PORT + SEED_LOG_PORT; |
| 230 |
PRINTD(1,"recvInfo: Random Port : %d \n", randomPort); |
| 231 |
|
| 232 |
|
| 233 |
sockAddress.sin_port = htons(randomPort); |
| 234 |
|
| 235 |
if (bind(logSock, (struct sockaddr *) &sockAddress, sizeof(sockAddress)) < 0) { |
| 236 |
PRINTD(1,"recvInfo: ** ERROR ** : Cannot bind a socket on port %d\n", randomPort); |
| 237 |
numTries++; |
| 238 |
exit = 1; |
| 239 |
} else |
| 240 |
exit = 0; |
| 241 |
|
| 242 |
} while ((exit == 1) && (numTries < OFFSET_LOG_PORT)); |
| 243 |
|
| 244 |
if (numTries > OFFSET_LOG_PORT) |
| 245 |
return 1; |
| 246 |
else |
| 247 |
return randomPort; |
| 248 |
} |
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
void createSignalingChannel() |
| 254 |
{ |
| 255 |
struct sockaddr_in signalSock; |
| 256 |
int sock_opt = 1; |
| 257 |
int opt_len = sizeof(sock_opt); |
| 258 |
|
| 259 |
|
| 260 |
signalSock.sin_family = AF_INET; |
| 261 |
signalSock.sin_port = htons(DEFAULT_LOG_PORT_SIGNALING); |
| 262 |
#if defined UNIX |
| 263 |
signalSock.sin_addr.s_addr = htonl(INADDR_ANY); |
| 264 |
#elif defined WIN32 |
| 265 |
signalSock.sin_addr.S_un.S_addr = htonl(INADDR_ANY); |
| 266 |
#endif |
| 267 |
|
| 268 |
if ((signalSocket = socket(AF_INET, SOCK_STREAM, 0)) < 0) { |
| 269 |
reportErrorAndExit("createSignalingChannel","socket","Cannot create socket signalSocket"); |
| 270 |
} |
| 271 |
|
| 272 |
if (setsockopt(signalSocket, SOL_SOCKET, SO_REUSEADDR, (char *) &sock_opt, opt_len) < 0) { |
| 273 |
reportErrorAndExit("createSignalingChannel", "setsockopt", "Error setting socket option"); |
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
if (bind(signalSocket, (struct sockaddr *) &signalSock, sizeof(signalSock)) < 0) { |
| 278 |
reportErrorAndExit("createSignalingChannel","bind","Cannot bind socket signalSocket"); |
| 279 |
} |
| 280 |
|
| 281 |
|
| 282 |
if (listen(signalSocket, SOMAXCONN) < 0) { |
| 283 |
reportErrorAndExit("createSignalingChannel","listen","Cannot listen on socket signalSocket"); |
| 284 |
} |
| 285 |
PRINTD(1,"createSignalingChannel: TCP signaling channel created with signalSocket : %d\n",signalSocket); |
| 286 |
} |
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
void *channelManager(void *param) |
| 292 |
{ |
| 293 |
|
| 294 |
paramLogThread *para; |
| 295 |
|
| 296 |
para = (paramLogThread *) param; |
| 297 |
|
| 298 |
char *fileLog; |
| 299 |
|
| 300 |
char logFile[DIM_LOG_FILE]; |
| 301 |
strcpy(logFile, DEFAULT_LOG_FILE); |
| 302 |
|
| 303 |
BYTE protocol; |
| 304 |
|
| 305 |
int newSockSignal = para->socket; |
| 306 |
|
| 307 |
recvInfo(newSockSignal, protocol, logFile); |
| 308 |
|
| 309 |
if ( MUTEX_THREAD_LOCK(mutexLog) < 0) |
| 310 |
reportErrorAndExit("channelManager","mutexThreadLock1","Cannot lock Log Mutex"); |
| 311 |
|
| 312 |
fileLog = allowedLogFile(logFile); |
| 313 |
|
| 314 |
if ( MUTEX_THREAD_UNLOCK(mutexLog) < 0) |
| 315 |
reportErrorAndExit("channelManager","mutexThreadUnlock1","Cannot unlock Log Mutex"); |
| 316 |
|
| 317 |
if (protocol == L4_PROTO_TCP) |
| 318 |
|
| 319 |
logPacketTCP(newSockSignal, (ofstream *) fileLog); |
| 320 |
|
| 321 |
else |
| 322 |
|
| 323 |
logPacketUDP(newSockSignal, (ofstream *) fileLog); |
| 324 |
|
| 325 |
if ( MUTEX_THREAD_LOCK(mutexLog) < 0) |
| 326 |
reportErrorAndExit("channelManager","mutexThreadLock2","Cannot lock Log Mutex"); |
| 327 |
|
| 328 |
closeFileLog((ofstream *) fileLog); |
| 329 |
|
| 330 |
if ( MUTEX_THREAD_UNLOCK(mutexLog) < 0) |
| 331 |
reportErrorAndExit("channelManager","mutexThreadUnlock2","Cannot unlock Log Mutex"); |
| 332 |
|
| 333 |
exitThread(); |
| 334 |
if ( closeSock(newSockSignal) < 0) |
| 335 |
reportErrorAndExit("channelManager","closeSock","Cannot close sock newSockSignal"); |
| 336 |
return 0; |
| 337 |
} |
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
void reportErrorAndExit(const char *function, const char *program, const char *msg) |
| 342 |
{ |
| 343 |
|
| 344 |
if (flagTerm == NO_TERMINATE) |
| 345 |
{ |
| 346 |
fprintf(stderr, "\n** ERROR **\n"); |
| 347 |
fprintf(stderr, "Function %s aborted caused by %s \n", function, program); |
| 348 |
fprintf(stderr, "** %s ** \n",msg); |
| 349 |
fflush(stderr); |
| 350 |
|
| 351 |
terminate(SIGTERM); |
| 352 |
} |
| 353 |
|
| 354 |
else if (flagTerm == ERROR_TERMINATE) |
| 355 |
{ |
| 356 |
fprintf(stderr, "\n** ERROR IN TERMINATE **\n"); |
| 357 |
fprintf(stderr, "Function %s aborted caused by %s \n", function, program); |
| 358 |
fprintf(stderr, "** %s ** \n",msg); |
| 359 |
fprintf(stderr, "Finish with error in terminate!\n"); |
| 360 |
fflush(stderr); |
| 361 |
exit(1); |
| 362 |
} |
| 363 |
|
| 364 |
else |
| 365 |
sleep(INFINITE); |
| 366 |
} |
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
void terminate(int sign) |
| 371 |
{ |
| 372 |
if (flagTerm == NO_TERMINATE) { |
| 373 |
|
| 374 |
flagTerm = TERMINATE; |
| 375 |
PRINTD(1,"terminate: ** Terminate function ***\n"); |
| 376 |
|
| 377 |
if ( MUTEX_THREAD_RELEASE(mutexLog) < 0) { |
| 378 |
|
| 379 |
flagTerm = ERROR_TERMINATE; |
| 380 |
reportErrorAndExit("terminate","MUTEX_THREAD_RELEASE","Cannot release Log Mutex"); |
| 381 |
} |
| 382 |
|
| 383 |
if (signalSocket != 0) { |
| 384 |
if ( closeSock(signalSocket) < 0) { |
| 385 |
|
| 386 |
flagTerm = ERROR_TERMINATE; |
| 387 |
reportErrorAndExit("terminate","closeSock","Cannot close socket signalSocket"); |
| 388 |
} |
| 389 |
} |
| 390 |
#ifdef WIN32 |
| 391 |
|
| 392 |
if ( WSACleanup() < 0){ |
| 393 |
|
| 394 |
flagTerm = ERROR_TERMINATE; |
| 395 |
reportErrorAndExit("terminate","WSACleanup","Cannot clean WSA"); |
| 396 |
} |
| 397 |
#endif |
| 398 |
|
| 399 |
if (sign == SIGINT) |
| 400 |
printf("Finish with CRTL-C! \n"); |
| 401 |
|
| 402 |
else if (sign == SIGTERM) |
| 403 |
printf("Finish requested caused by errors! \n"); |
| 404 |
} |
| 405 |
exit(1); |
| 406 |
} |
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
void logInit() |
| 411 |
{ |
| 412 |
|
| 413 |
#ifdef WIN32 |
| 414 |
if ( InitializeWinsock(MAKEWORD(1,1)) != 1) { |
| 415 |
flagTerm = ERROR_TERMINATE; |
| 416 |
reportErrorAndExit("logInit","InitializeWinsock","Cannot initialize WinSocket"); |
| 417 |
} |
| 418 |
#endif |
| 419 |
if ( MUTEX_THREAD_INIT(mutexLog) < 0) |
| 420 |
reportErrorAndExit("logInit","CreateMutex","Cannot initialize Mutex"); |
| 421 |
} |
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
void parserLog(int argc, char *argv[]) { |
| 426 |
|
| 427 |
if (argc > 0) { |
| 428 |
|
| 429 |
if (argv[0][0] == '-') { |
| 430 |
switch (argv[0][1]) { |
| 431 |
|
| 432 |
case 'h': |
| 433 |
printHelpAndExit(); |
| 434 |
break; |
| 435 |
case 'q': |
| 436 |
if ((argc < 2) || (argv[1][0] == '-')){ |
| 437 |
argc -= 1; |
| 438 |
argv += 1; |
| 439 |
} else { |
| 440 |
logbuffer_size = atoi(argv[1]); |
| 441 |
argc -= 2; |
| 442 |
argv += 2; |
| 443 |
} |
| 444 |
break; |
| 445 |
default: |
| 446 |
|
| 447 |
char* tail = (char *) malloc(sizeof("Unknown option ") + sizeof(argv[0][1])); |
| 448 |
if (tail == NULL) |
| 449 |
reportErrorAndExit("parserLog", "malloc1", "Insufficient memory available"); |
| 450 |
|
| 451 |
sprintf(tail, "Unknow option : %s", argv[0]); |
| 452 |
#ifdef UNIX |
| 453 |
printf("Type: ./ITGLog -h for help\n"); |
| 454 |
#endif |
| 455 |
#ifdef WIN32 |
| 456 |
printf("Type: ITGLog.exe -h for help\n"); |
| 457 |
#endif |
| 458 |
|
| 459 |
reportErrorAndExit("parserLog", "general parser", tail); |
| 460 |
break; |
| 461 |
} |
| 462 |
|
| 463 |
} else { |
| 464 |
|
| 465 |
char* tail = (char *) malloc(sizeof("Unknown option ") + sizeof(argv[0])); |
| 466 |
if (tail == NULL) |
| 467 |
reportErrorAndExit("parserLog", "malloc2", "Insufficient memory available"); |
| 468 |
|
| 469 |
sprintf(tail, "Unknow option : %s", argv[0]); |
| 470 |
#ifdef UNIX |
| 471 |
printf("Type: ./ITGLog -h for help\n"); |
| 472 |
#endif |
| 473 |
#ifdef WIN32 |
| 474 |
printf("Type: ITGLog.exe -h for help\n"); |
| 475 |
#endif |
| 476 |
|
| 477 |
reportErrorAndExit("parserLog", "general parser", tail); |
| 478 |
} |
| 479 |
} |
| 480 |
} |
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
int main(int argc, char *argv[]) |
| 485 |
{ |
| 486 |
|
| 487 |
pthread_t hThr[MAX_NUM_THREAD]; |
| 488 |
|
| 489 |
|
| 490 |
paramLogThread para[MAX_NUM_THREAD]; |
| 491 |
|
| 492 |
printVersion("ITGLog"); |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
pthread_t t1; |
| 497 |
if (argc > 1){ |
| 498 |
if (strcmp(argv[1],"-gui") == 0){ |
| 499 |
CREATE_THREAD((void*)"wait", &waitStopKey, NULL, t1, true); |
| 500 |
argc--; |
| 501 |
argv++; |
| 502 |
} |
| 503 |
} |
| 504 |
|
| 505 |
|
| 506 |
signal(SIGINT, terminate); |
| 507 |
|
| 508 |
|
| 509 |
for (int i = 0; i < MAX_NUM_THREAD; i++) { |
| 510 |
hThr[i] = 0; |
| 511 |
memLogFile[i].num = -1; |
| 512 |
strcpy(memLogFile[i].logFile, " "); |
| 513 |
para[i].socket = 0; |
| 514 |
} |
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
logInit(); |
| 519 |
|
| 520 |
|
| 521 |
argv++; |
| 522 |
|
| 523 |
argc--; |
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
parserLog(argc,argv); |
| 528 |
|
| 529 |
|
| 530 |
int newSockSignal; |
| 531 |
|
| 532 |
|
| 533 |
socklen_t sinLen = sizeof(senderLog); |
| 534 |
|
| 535 |
|
| 536 |
createSignalingChannel(); |
| 537 |
|
| 538 |
printf("Press Ctrl-C to terminate!\n"); |
| 539 |
fflush(stdout); |
| 540 |
|
| 541 |
int i = 0; |
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
while (1) { |
| 546 |
newSockSignal = accept(signalSocket, (struct sockaddr *) &senderLog, &sinLen); |
| 547 |
if (newSockSignal < 0) |
| 548 |
reportErrorAndExit("main","accept","Cannot accept socket newSockSignal"); |
| 549 |
else { |
| 550 |
|
| 551 |
#ifdef DEBUG |
| 552 |
|
| 553 |
char hostName[50]; |
| 554 |
|
| 555 |
char hostIP[20]; |
| 556 |
int rit1 = getnameinfo((sockaddr*)&senderLog,sinLen,hostName, INET_ADDRSTRLEN, NULL, 0, |
| 557 |
NI_NOFQDN); |
| 558 |
int rit2 = getnameinfo((sockaddr*)&senderLog,sinLen,hostIP, INET_ADDRSTRLEN, NULL, 0, |
| 559 |
NI_NUMERICHOST); |
| 560 |
if ((rit1 == 0) & (rit2 == 0)) |
| 561 |
printf("Received %dth request of Remote Log from %s(%s)\n", i+1, hostName,hostIP); |
| 562 |
else if ((rit1 != 0) & (rit2 == 0)) |
| 563 |
printf("Received %dth request of Remote Log from %s\n",i+1,hostIP); |
| 564 |
else |
| 565 |
printf("Received %dth request of Remote Log \n",i+1); |
| 566 |
#endif |
| 567 |
PRINTD(1,"main: newSockSignal : %d\n",newSockSignal); |
| 568 |
|
| 569 |
|
| 570 |
para[i].socket = newSockSignal; |
| 571 |
|
| 572 |
if ( CREATE_THREAD(¶[i], channelManager, NULL, hThr[i], true) < 0) |
| 573 |
reportErrorAndExit("main","createThread","Cannot create thread"); |
| 574 |
PRINTD(2,"main: Return value CREATE_THREAD channelManager hThr[i] : %lu \n",(unsigned long int)hThr[i]); |
| 575 |
i++; |
| 576 |
} |
| 577 |
} |
| 578 |
return 0; |
| 579 |
} |