zeromq / chumak

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

Add multipart message support for `REQ` sockets #53

Closed siiky closed 1 year ago

siiky commented 1 year ago

Fix #52

siiky commented 1 year ago

I added the missing case to recv_multipart (I think) but when I tried it I still got a single binary. Then I noticed this lists_to_binary call:

https://github.com/zeromq/chumak/blob/f89a873ea2d4b94d3d415228b72cf4f92f076af5/src/chumak_req.erl#L138-L154

It looks like it's assumed only recv would be used. Is there an easy/immediate way to distinguish between a client having called recv or recv_multipart? I was thinking that if there isn't, the easiest thing would probably be to move the list_to_binary to the client process (i.e. chumak:recv()), and the socket process always sends the list of binaries.

siiky commented 1 year ago

Alright, I think this is functioning now and will serve me well on the project.

I don't like the is_multipart flag, feels like a duct tape hack. Waiting for your review before I squash the commits to merge.

drozzy commented 1 year ago

Merged.