Skip to content

Commit

Permalink
Try catch for blocking recieve which can throw
Browse files Browse the repository at this point in the history
  • Loading branch information
tmatthey committed May 6, 2024
1 parent 97da3b4 commit e8a6405
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/NetMQ/Core/Mailbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Diagnostics;
using System.Net.Sockets;
using NetMQ.Core.Utils;
Expand Down Expand Up @@ -208,8 +209,17 @@ public bool TryRecv(int timeout, out Command command)
return true;

// If there are no more commands available, switch into passive state.
m_active = false;
m_signaler.Recv();
try
{
m_active = false;
m_signaler.Recv();
}
catch
{
m_active = true;
command = default(Command);
return false;
}
}

// Wait for signal from the command sender.
Expand Down

0 comments on commit e8a6405

Please sign in to comment.