Closed Lswks closed 4 years ago
/** {@inheritDoc} */ @Override public void handleAuthRequest(String addr, InboundChannelHandler inboundChannelHandler) { log.info("Auth requested[{}], sending [auth {}]", addr, "*****"); for (ServerOption serverOption : option().serverOptions()) { String password = serverOption.password(); if (password == null) { password = option().defaultPassword(); } if (StringUtils.equals(addr, serverOption.addr())) { EslMessage response = inboundChannelHandler.sendSyncSingleLineCommand("auth " + password); log.debug("Auth response [{}]", response); if (response.getContentType().equals(EslHeaders.Value.COMMAND_REPLY)) { CommandResponse reply = new CommandResponse("auth " + password, response); serverOption.state(ConnectState.AUTHED); log.info("Auth response success={}, message=[{}]", reply.isOk(), reply.getReplyText()); if (!option().events().isEmpty()) { StringBuilder sb = new StringBuilder(); sb.append("event plain "); for (String event : option().events()) { sb.append(event).append(" "); } setEventSubscriptions(addr, "plain", sb.toString()); } } else { serverOption.state(ConnectState.AUTHED_FAILED); log.error("Bad auth response message [{}]", response); throw new IllegalStateException("Incorrect auth response"); } } } }
setEventSubscriptions(addr, "plain", sb.toString()); 这句是不是有个bug呢,因为setEventSubscriptions里面的逻辑是'event ' + 'plain ' + sb.toString(), 这时会造成重复拼接,以all为例,最后出来一个event plain event plain all 。 仅看了代码,没有调试~
event plain event plain all
非常感谢,的确存在重复拼接的问题。目前已调整,后期如遇到问题,可以直接提ISSUE和PR,谢谢。
setEventSubscriptions(addr, "plain", sb.toString()); 这句是不是有个bug呢,因为setEventSubscriptions里面的逻辑是'event ' + 'plain ' + sb.toString(), 这时会造成重复拼接,以all为例,最后出来一个
event plain event plain all
。 仅看了代码,没有调试~