Skip to content

Commit

Permalink
[ISSUE #212]For multiple listening instances, only the last started i…
Browse files Browse the repository at this point in the history
…nstance can receive messages
  • Loading branch information
xwm1992 committed Feb 7, 2021
1 parent 481cf7d commit 1ffdebe
Showing 1 changed file with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,7 @@ public void processRequest(ChannelHandlerContext ctx, AsyncContext<HttpCommand>
proxyHTTPServer.localClientInfoMapping.put(groupTopicClientMapping.getKey(), groupTopicClientMapping.getValue());
}else {
List<Client> tmpClientList = groupTopicClientMapping.getValue();
for (Client tmpClient : tmpClientList){
boolean isContains = false;
for (Client localClient : localClientList){
if (StringUtils.equals(localClient.url, tmpClient.url)){
isContains = true;
break;
}
}
if (!isContains){
localClientList.add(tmpClient);
}
}
supplyClientInfoList(tmpClientList, localClientList);
proxyHTTPServer.localClientInfoMapping.put(groupTopicClientMapping.getKey(), localClientList);
}

Expand Down Expand Up @@ -203,6 +192,21 @@ public void onResponse(HttpCommand httpCommand) {

}

private void supplyClientInfoList(List<Client> tmpClientList, List<Client> localClientList) {
for (Client tmpClient : tmpClientList){
boolean isContains = false;
for (Client localClient : localClientList){
if (StringUtils.equals(localClient.url, tmpClient.url)){
isContains = true;
break;
}
}
if (!isContains){
localClientList.add(tmpClient);
}
}
}

@Override
public boolean rejectRequest() {
return false;
Expand Down

0 comments on commit 1ffdebe

Please sign in to comment.