对SNCP的Address进行IPv4判断

This commit is contained in:
Redkale
2017-12-04 09:48:52 +08:00
parent e97e6b8262
commit 1da73429f7
2 changed files with 3 additions and 1 deletions

View File

@@ -103,6 +103,7 @@ public final class SncpClient {
this.actions = methodens.toArray(new SncpAction[methodens.size()]);
this.addrBytes = clientAddress == null ? new byte[4] : clientAddress.getAddress().getAddress();
this.addrPort = clientAddress == null ? 0 : clientAddress.getPort();
if (this.addrBytes.length != 4) throw new RuntimeException("SNCP clientAddress only support IPv4");
}
static List<SncpAction> getSncpActions(final Class serviceClass) {

View File

@@ -49,6 +49,7 @@ public final class SncpResponse extends Response<SncpContext, SncpRequest> {
super(context, request);
this.addrBytes = context.getServerAddress().getAddress().getAddress();
this.addrPort = context.getServerAddress().getPort();
if (this.addrBytes.length != 4) throw new RuntimeException("SNCP serverAddress only support IPv4");
}
public void finish(final int retcode, final BsonWriter out) {