Skip to content

Commit 57119a0

Browse files
committed
Remove ProxyType entirely, as the lifetime of the string is managed by the queue after push
1 parent 6ed437d commit 57119a0

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

MessageControl/MessageOutput.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ namespace Publishers {
132132
UDPOutput::Channel::Channel(const Core::NodeId& nodeId)
133133
: Core::SocketDatagram(false, nodeId.Origin(), nodeId, Messaging::MessageUnit::Instance().DataSize(), 0)
134134
, _queue()
135-
, _stringPool(ProxyPoolTypeSize)
136135
{
137136
}
138137
UDPOutput::Channel::~Channel()
@@ -150,12 +149,12 @@ namespace Publishers {
150149
_adminLock.Unlock();
151150
}
152151
else {
153-
Core::ProxyType<string> msg = _queue.front();
152+
string msg = _queue.front();
154153
_queue.pop();
155154
_adminLock.Unlock();
156155

157-
actualByteCount = std::min<uint16_t>(msg->size(), maxSendSize);
158-
memcpy(dataFrame, msg->c_str(), actualByteCount);
156+
actualByteCount = std::min<uint16_t>(msg.size(), maxSendSize);
157+
memcpy(dataFrame, msg.c_str(), actualByteCount);
159158
}
160159

161160
return (actualByteCount);
@@ -174,9 +173,7 @@ namespace Publishers {
174173
{
175174
_adminLock.Lock();
176175

177-
Core::ProxyType<string> msg = _stringPool.Element();
178-
*msg = text;
179-
_queue.push(msg);
176+
_queue.push(text);
180177

181178
_adminLock.Unlock();
182179

MessageControl/MessageOutput.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ namespace Publishers {
345345

346346
class UDPOutput : public IPublish {
347347
private:
348-
static constexpr uint32_t ProxyPoolTypeSize = 10;
349-
350348
class Channel : public Core::SocketDatagram {
351349
public:
352350
Channel() = delete;
@@ -364,8 +362,7 @@ namespace Publishers {
364362
uint16_t ReceiveData(uint8_t*, const uint16_t) override;
365363
void StateChange() override;
366364

367-
std::queue<Core::ProxyType<string>> _queue;
368-
Core::ProxyPoolType<string> _stringPool;
365+
std::queue<string> _queue;
369366
Core::CriticalSection _adminLock;
370367
};
371368

0 commit comments

Comments
 (0)