The full broker source code is on github, in any case, the changes are in the way multipart messages are managed.
For instance, we can have a look at MyDevice::receivingOnBackend():
void receivingOnBackend() { // zmq::Frames input = backend_.blockingRecv(3, false); zmq::Frames input = backend_.blockingRecv(5, false); // workerID (, "", clientID, "", payload) // 1 // ... // if(input.size() == 3) if(input.size() == 5) // 2 { // zmq::Frames output(input.begin() + 1, input.end()); zmq::Frames output(input.begin() + 2, input.end()); // 3 frontend_.send(output); } }1. On the backend we receive a workerID and, normally, the clientID and the message payload. That means one or three "real" frames. In my original implementation, we didn't get the separators, now we do. So we get a total of one or five frames.
2. As said above, a full message now has size 5, and not anymore 3.
3. We send to the frontend the clientID and the payload, to do that we discard the first two frames, the workerID and the first separator.
No comments:
Post a Comment