int Manager::addSource(int workerType, int src_id, char* ip, int port) { LOG4CXX_DEBUG(logger, "Adding source: " << src_id << " with address: " << ip << ":" << port); //Pointer to socketWorker Worker *s = this->getWorker(workerType, port); // Add the new source to the worker if (s != NULL && s->addSource(src_id, ip, port)) { // Save the new src_id to worker reference srcIdWorker[src_id] = s; workerIdWorker[s->getWorkerId()] = s; // Update the currentWorker Identifier currentWorkerId++; if (currentWorkerId >= MAX_WORKERS) currentWorkerId = 0; return 0; } else { LOG4CXX_ERROR(logger, "Error adding the source: " << src_id ); return -1; } }