MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / RunPollLoop

Method RunPollLoop

Source/URLab/Private/Transport/ZmqRpcTransport.cpp:101–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void UURLabZmqRpcTransport::RunPollLoop()
102{
103 while (!bStop.load(std::memory_order_acquire))
104 {
105 zmq_msg_t Msg;
106 zmq_msg_init(&Msg);
107 int rc = zmq_msg_recv(&Msg, ZmqRep, 0);
108 if (rc < 0)
109 {
110 zmq_msg_close(&Msg);
111 // Timeout or shutdown — loop and check bStop.
112 continue;
113 }
114
115 const int Size = zmq_msg_size(&Msg);
116 TArray<uint8> InBytes;
117 InBytes.SetNumUninitialized(Size);
118 if (Size > 0)
119 FMemory::Memcpy(InBytes.GetData(), zmq_msg_data(&Msg), Size);
120 zmq_msg_close(&Msg);
121
122 // Wire detect / parse / dispatch / encode all live on the base.
123 TArray<uint8> OutBytes;
124 ProcessRequestBytes(InBytes, OutBytes);
125 zmq_send(ZmqRep, OutBytes.GetData(), OutBytes.Num(), 0);
126 }
127}

Callers 1

RunMethod · 0.45

Calls 1

GetDataMethod · 0.80

Tested by

no test coverage detected