|
|
|
|
@ -61,14 +61,14 @@ CDPlusProtocolHandler* CDPlusProtocolHandlerPool::getHandler(unsigned int port)
|
|
|
|
|
if (proto) {
|
|
|
|
|
if (proto->open()) {
|
|
|
|
|
m_pool[port] = proto;
|
|
|
|
|
CLog::logInfo("New CDPlusProtocolHandler now on UDP port %u.\n", port);
|
|
|
|
|
CLog::logInfo("New D Plus Protocol Handler now on UDP port %u.\n", port);
|
|
|
|
|
} else {
|
|
|
|
|
delete proto;
|
|
|
|
|
proto = NULL;
|
|
|
|
|
CLog::logInfo("ERROR: Can't open new DPlus UDP port %u!\n", port);
|
|
|
|
|
CLog::logError("Can't open new DPlus UDP port %u!\n", port);
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
CLog::logInfo("ERROR: Can't allocate new CDPlusProtocolHandler at port %u\n", port);
|
|
|
|
|
CLog::logError("Can't allocate new DPlus ProtocolHandler at port %u\n", port);
|
|
|
|
|
return proto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -77,15 +77,16 @@ void CDPlusProtocolHandlerPool::release(CDPlusProtocolHandler *handler)
|
|
|
|
|
assert(handler != NULL);
|
|
|
|
|
for (auto it=m_pool.begin(); it!=m_pool.end(); it++) {
|
|
|
|
|
if (it->second == handler) {
|
|
|
|
|
it->second->close();
|
|
|
|
|
delete it->second;
|
|
|
|
|
CLog::logInfo("Releasing CDPlusProtocolHandler on port %u.\n", it->first);
|
|
|
|
|
m_pool.erase(it);
|
|
|
|
|
handler->close();
|
|
|
|
|
delete handler;
|
|
|
|
|
m_index = m_pool.end(); // m_index might be ut of order so reset it
|
|
|
|
|
CLog::logInfo("Releasing DPlus ProtocolHandler on port %u.\n", it->first);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// we should never get here!
|
|
|
|
|
CLog::logInfo("ERROR: could not find CDPlusProtocolHander (port=%u) to release!\n", handler->getPort());
|
|
|
|
|
CLog::logInfo("ERROR: could not find DPlus ProtocolHander (port=%u) to release!\n", handler->getPort());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DPLUS_TYPE CDPlusProtocolHandlerPool::read()
|
|
|
|
|
|