对SNCP的Address进行IPv4判断
This commit is contained in:
@@ -103,6 +103,7 @@ public final class SncpClient {
|
|||||||
this.actions = methodens.toArray(new SncpAction[methodens.size()]);
|
this.actions = methodens.toArray(new SncpAction[methodens.size()]);
|
||||||
this.addrBytes = clientAddress == null ? new byte[4] : clientAddress.getAddress().getAddress();
|
this.addrBytes = clientAddress == null ? new byte[4] : clientAddress.getAddress().getAddress();
|
||||||
this.addrPort = clientAddress == null ? 0 : clientAddress.getPort();
|
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) {
|
static List<SncpAction> getSncpActions(final Class serviceClass) {
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public final class SncpResponse extends Response<SncpContext, SncpRequest> {
|
|||||||
super(context, request);
|
super(context, request);
|
||||||
this.addrBytes = context.getServerAddress().getAddress().getAddress();
|
this.addrBytes = context.getServerAddress().getAddress().getAddress();
|
||||||
this.addrPort = context.getServerAddress().getPort();
|
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) {
|
public void finish(final int retcode, final BsonWriter out) {
|
||||||
|
|||||||
Reference in New Issue
Block a user