zeromq / chumak

Pure Erlang implementation of ZeroMQ Message Transport Protocol.
Mozilla Public License 2.0
197 stars 47 forks source link

Chumak disconnects all clients when one misbehaves #23

Closed DavidAlphaFox closed 6 years ago

DavidAlphaFox commented 6 years ago

Dear author

I'm a user of Chumak. I found that Chumak disconnects all clients when one misbehaves. After I searched stackoverflow.com , I found someone else also have same problem.

So I modify some code to deal this error. Please consider my patch.

drozzy commented 6 years ago

Thank you for the patch.

One follow up question, is this the intended behaviour? Because this seems to catch all such errors and silence them.

+    try 
 +        gen_server:call(PeerPid, incoming_queue_out)
 +    catch 
 +        _Error:_Info -> ok
 +    end.
DavidAlphaFox commented 6 years ago

Thanks for your rely. Yes you are right.

It's my intended at first, because I think implementations such as chumak_router should not exit until we want to. But after I submitted this patch, I found this patch may affect implementations such as chumak_rep which may not behave correctly when another side crashed.

Now I'm still working on this question, I think I should put this behaviour into some implementations but not chumak_peer.

I will submit another patch will make it better .