@@ -131,9 +131,9 @@ namespace Publishers {
131131 // UDPOutput
132132 UDPOutput::Channel::Channel (const Core::NodeId& nodeId)
133133 : Core::SocketDatagram(false , nodeId.Origin(), nodeId, Messaging::MessageUnit::Instance().DataSize(), 0 )
134- , _loaded(0 )
134+ , _queue()
135+ , _stringPool(ProxyPoolTypeSize)
135136 {
136- ::memset (_sendBuffer, 0 , sizeof (_sendBuffer));
137137 }
138138 UDPOutput::Channel::~Channel ()
139139 {
@@ -142,13 +142,21 @@ namespace Publishers {
142142
143143 uint16_t UDPOutput::Channel::SendData (uint8_t * dataFrame, const uint16_t maxSendSize)
144144 {
145+ uint16_t actualByteCount = 0 ;
146+
145147 _adminLock.Lock ();
146148
147- uint16_t actualByteCount = (_loaded > maxSendSize ? maxSendSize : _loaded);
148- memcpy (dataFrame, _sendBuffer, actualByteCount);
149- _loaded = 0 ;
149+ if (_queue.empty () == true ) {
150+ _adminLock.Unlock ();
151+ }
152+ else {
153+ Core::ProxyType<string> msg = _queue.front ();
154+ _queue.pop ();
155+ _adminLock.Unlock ();
150156
151- _adminLock.Unlock ();
157+ actualByteCount = std::min<uint16_t >(msg->size (), maxSendSize);
158+ memcpy (dataFrame, msg->c_str (), actualByteCount);
159+ }
152160
153161 return (actualByteCount);
154162 }
@@ -166,14 +174,9 @@ namespace Publishers {
166174 {
167175 _adminLock.Lock ();
168176
169- ASSERT ((_loaded + text.length () + 1 ) < sizeof (_sendBuffer));
170-
171- if ((_loaded + text.length () + 1 ) < sizeof (_sendBuffer)) {
172- Core::FrameType<0 > frame (_sendBuffer + _loaded, sizeof (_sendBuffer) - _loaded, sizeof (_sendBuffer) - _loaded);
173- Core::FrameType<0 >::Writer frameWriter (frame, 0 );
174- frameWriter.NullTerminatedText (text);
175- _loaded += frameWriter.Offset ();
176- }
177+ Core::ProxyType<string> msg = _stringPool.Element ();
178+ *msg = text;
179+ _queue.push (msg);
177180
178181 _adminLock.Unlock ();
179182
0 commit comments