LivoxProto1: Document UDP demuxer purpose & use cases
Also fix bug in transient resource transfer from continuation to Device object.
This commit is contained in:
@@ -1714,13 +1714,13 @@ private:
|
||||
// Transfer ownership of the socket from temporary to main descriptor
|
||||
if (tmpPcloudEnableFdDesc.is_open())
|
||||
{
|
||||
// Close the temporary descriptor (but don't close the fd)
|
||||
int fd = tmpPcloudEnableFdDesc.native_handle();
|
||||
tmpPcloudEnableFdDesc.release();
|
||||
// Give the transient FD to the Device object.
|
||||
device.pcloudDataSocketDesc =
|
||||
std::make_unique<boost::asio::posix::stream_descriptor>(
|
||||
device.componentThread->getIoService(), fd);
|
||||
|
||||
// Close the temporary descriptor (but don't close the fd)
|
||||
tmpPcloudEnableFdDesc.release();
|
||||
}
|
||||
device.pcloudDataActive.store(true);
|
||||
}
|
||||
@@ -1888,6 +1888,14 @@ void Device::registerUdpCommandHandler(
|
||||
const std::string& deviceIP
|
||||
)
|
||||
{
|
||||
/** EXPLANATION:
|
||||
* Register a UDP command handler for the given cmd_set and cmd_id.
|
||||
* If the handler already exists for the given device IP, replace it.
|
||||
* If the handler does not exist, add it to the temporary collection.
|
||||
*
|
||||
* Adding a handler to a cmd_set+cmd_id pair which already has a handler
|
||||
* results in the new handler replacing the old one.
|
||||
*/
|
||||
auto key = std::make_pair(cmd_set, cmd_id);
|
||||
udpCommandHandlers[key] = handler; // Don't move, we need to copy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user