bugfixes
This commit is contained in:
@@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.zeromq.SocketType;
|
||||
import org.zeromq.ZContext;
|
||||
import org.zeromq.ZMQ;
|
||||
import org.zeromq.ZMQException;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.util.HashMap;
|
||||
@@ -180,15 +181,22 @@ public class ZmqChannelManager implements Closeable {
|
||||
public boolean sendToWorker(byte[] identity, byte versionByte, byte messageTypeByte, byte[] protobufData) {
|
||||
ZMQ.Socket socket = getSocket(Channel.INGESTOR_BROKER);
|
||||
|
||||
if (!socket.send(identity, ZMQ.SNDMORE)) return false;
|
||||
if (!socket.send(new byte[0], ZMQ.SNDMORE)) return false;
|
||||
if (!socket.send(new byte[]{versionByte}, ZMQ.SNDMORE)) return false;
|
||||
try {
|
||||
if (!socket.send(identity, ZMQ.SNDMORE)) return false;
|
||||
if (!socket.send(new byte[0], ZMQ.SNDMORE)) return false;
|
||||
if (!socket.send(new byte[]{versionByte}, ZMQ.SNDMORE)) return false;
|
||||
|
||||
byte[] frame = new byte[1 + protobufData.length];
|
||||
frame[0] = messageTypeByte;
|
||||
System.arraycopy(protobufData, 0, frame, 1, protobufData.length);
|
||||
byte[] frame = new byte[1 + protobufData.length];
|
||||
frame[0] = messageTypeByte;
|
||||
System.arraycopy(protobufData, 0, frame, 1, protobufData.length);
|
||||
|
||||
return socket.send(frame, 0);
|
||||
return socket.send(frame, 0);
|
||||
} catch (ZMQException e) {
|
||||
// ROUTER_MANDATORY throws (not returns false) for unreachable peer identities.
|
||||
// Returning false lets the caller detect and purge the stale slot.
|
||||
LOG.debug("sendToWorker failed (errno={}): {}", e.getErrorCode(), e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user