Skip to content

Commit 7c8cce3

Browse files
committed
Changed how the function is formatted.
1 parent dc25cdc commit 7c8cce3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/NetMQ/NetMQBeacon.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private void OnUdpReady(Socket socket)
199199
{
200200
Assumes.NotNull(m_pipe);
201201

202-
var frame = ReceiveUdpFrame(out string peerName);
202+
if (!ReceiveUdpFrame(out NetMQFrame frame, out string peerName)) return;
203203

204204
// If filter is set, check that beacon matches it
205205
var isValid = frame.MessageSize >= m_filter?.MessageSize && Compare(frame, m_filter, m_filter.MessageSize);
@@ -280,7 +280,7 @@ private void SendUdpFrame(NetMQFrame frame)
280280
}
281281
}
282282

283-
private NetMQFrame ReceiveUdpFrame(out string peerName)
283+
private bool ReceiveUdpFrame(out NetMQFrame frame, out string peerName)
284284
{
285285
Assumes.NotNull(m_udpSocket);
286286

@@ -295,10 +295,14 @@ private NetMQFrame ReceiveUdpFrame(out string peerName)
295295
catch(SocketException ex)
296296
{
297297
if (ex.SocketErrorCode != SocketError.MessageSize) { throw; }
298+
frame = new NetMQFrame("");
299+
peerName = "";
300+
return false;
298301
}
299302
peerName = peer.ToString();
303+
frame = new NetMQFrame(buffer, bytesRead);
300304

301-
return new NetMQFrame(buffer, bytesRead);
305+
return true;
302306
}
303307
}
304308

0 commit comments

Comments
 (0)