vert-x3 / vertx-tcp-eventbus-bridge

Apache License 2.0
49 stars 44 forks source link

ping messages return unknown_type #37

Closed nfranke closed 6 years ago

nfranke commented 6 years ago

Version

Context

When clients send a "ping" message, the server responds with an error "unknwon_type"

Steps to reproduce

  1. client sends "ping" command
  2. server returns error

Extra

In TcpEventBusBridgeImpl.java in the method: private void handler(NetSocket socket) the code is as follows:

      checkCallHook(() -> new BridgeEventImpl(eventType, msg, socket),
        () -> {
          if (eventType == BridgeEventType.SOCKET_PING) {
            // No specific action
          } else if (address == null) {
            sendErrFrame("missing_address", socket);
            log.error("msg does not have address: " + msg.toString());
            return;
          }
          doSendOrPub(true, socket, address, msg, registry, replies);
        },
        () -> {
          sendErrFrame("blocked by bridgeEvent handler", socket);
        });

Perhaps the call to doSendOrPub(true, socket, address, msg, registry, replies) should be wrapped in an:

} else {
    doSendOrPub(true, socket, address, msg, registry, replies);
}

In this case eventType == BridgeEventType.SOCKET_PING is true, but it still does the doSendOrPub

pmlopes commented 6 years ago

This looks like a bug where the pong response is missing.

vietj commented 6 years ago

can you make a fix for 3.5.2 ?

gaol commented 6 years ago

@vietj @pmlopes I made up a PR: https://github.com/vert-x3/vertx-tcp-eventbus-bridge/pull/38 for this issue, would you please review? Thanks.

pmlopes commented 6 years ago

The pr has been merged!