IoUringAsmEngn: Use pcloudDataSocket from UdpCmdDemux

This commit is contained in:
2025-11-01 23:01:11 -04:00
parent 5845f1a41d
commit 14b97a52ed
3 changed files with 12 additions and 7 deletions
+6 -5
View File
@@ -61,6 +61,12 @@ public:
return pcloudDataSocketDesc; return pcloudDataSocketDesc;
} }
private:
// Socket and async objects
std::shared_ptr<boost::asio::posix::stream_descriptor> pcloudDataSocketDesc;
// Socket and async objects
std::shared_ptr<boost::asio::posix::stream_descriptor> cmdEndpointFdDesc;
private: private:
void setupSockets(); void setupSockets();
void setupCommandSocket(); void setupCommandSocket();
@@ -74,11 +80,6 @@ private:
uint16_t commandPort; uint16_t commandPort;
uint16_t dataPort; uint16_t dataPort;
// Socket and async objects
std::shared_ptr<boost::asio::posix::stream_descriptor> pcloudDataSocketDesc;
// Socket and async objects
std::shared_ptr<boost::asio::posix::stream_descriptor> cmdEndpointFdDesc;
// State management // State management
std::atomic<bool> isActive{false}; std::atomic<bool> isActive{false};
std::atomic<bool> shouldStop{false}; std::atomic<bool> shouldStop{false};
@@ -3,6 +3,7 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <boost/system/error_code.hpp> #include <boost/system/error_code.hpp>
#include <livoxProto1/device.h> #include <livoxProto1/device.h>
#include <livoxProto1/livoxProto1.h>
#include "ioUringAssemblyEngine.h" #include "ioUringAssemblyEngine.h"
#include "pcloudStimulusBuffer.h" #include "pcloudStimulusBuffer.h"
#include "livoxGen1.h" #include "livoxGen1.h"
@@ -45,7 +46,7 @@ bool IoUringAssemblyEngine::setup()
if (!frameAssemblyDesc || frameAssemblyDesc->slots.empty()) if (!frameAssemblyDesc || frameAssemblyDesc->slots.empty())
{ return false; } { return false; }
// Get UDP socket file descriptor // Get point cloud data socket descriptor from UdpCommandDemuxer
int udpFd = (*livoxProto1.livoxProto1_getPcloudDataFdDesc)() int udpFd = (*livoxProto1.livoxProto1_getPcloudDataFdDesc)()
->native_handle(); ->native_handle();
if (udpFd < 0) if (udpFd < 0)
@@ -86,7 +87,7 @@ void IoUringAssemblyEngine::resetAndAssembleFrame()
// 1. Submit frameAssemblyDesc->numSlots RECVMSG SQEs using io_uring_prep_recvmsg() // 1. Submit frameAssemblyDesc->numSlots RECVMSG SQEs using io_uring_prep_recvmsg()
// - Each SQE receives into frameAssemblyDesc->slots[i].vaddr // - Each SQE receives into frameAssemblyDesc->slots[i].vaddr
// - With size frameAssemblyDesc->slots[i].nBytes // - With size frameAssemblyDesc->slots[i].nBytes
// - Socket FD from parent.device->pcloudDataSocketDesc->native_handle() // - Socket FD from pcloudDataSocketDesc->native_handle()
// 2. Submit batch via io_uring_submit(&ring) // 2. Submit batch via io_uring_submit(&ring)
// 3. Set up stall timer using stallTimer with appropriate timeout // 3. Set up stall timer using stallTimer with appropriate timeout
// - SQEs are independent and can arrive out of order // - SQEs are independent and can arrive out of order
@@ -46,6 +46,9 @@ private:
struct io_uring ring; struct io_uring ring;
bool isSetup; bool isSetup;
// Point cloud data socket descriptor
std::shared_ptr<boost::asio::posix::stream_descriptor> pcloudDataSocketDesc;
// Stall detection timer // Stall detection timer
boost::asio::deadline_timer stallTimer; boost::asio::deadline_timer stallTimer;