summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-09-20 21:21:43 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-09-20 21:21:43 -0700
commit29711e123febee2696e0f2cada72e7e533d21a8c (patch)
treefc9ebaed3d868c318520d58effa34653abf2ad7e /java
parentd3524f36090c47e11c2647f022b03e27d16aeb13 (diff)
parentd87f0293e3bdbb013ce2b48d5518a22e3ecd8c71 (diff)
downloadinfinitytier-29711e123febee2696e0f2cada72e7e533d21a8c.tar.gz
infinitytier-29711e123febee2696e0f2cada72e7e533d21a8c.zip
Merge branch 'dev' of http://10.6.6.2/zerotier/ZeroTierOne into dev
Diffstat (limited to 'java')
-rw-r--r--java/jni/ZT_jniutils.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/java/jni/ZT_jniutils.cpp b/java/jni/ZT_jniutils.cpp
index f73c408b..6faa91a4 100644
--- a/java/jni/ZT_jniutils.cpp
+++ b/java/jni/ZT_jniutils.cpp
@@ -162,7 +162,7 @@ jobject createPeerRole(JNIEnv *env, ZT_PeerRole role)
case ZT_PEER_ROLE_LEAF:
fieldName = "PEER_ROLE_LEAF";
break;
- case ZT_PEER_ROLE_RELAY:
+ case ZT_PEER_ROLE_UPSTREAM:
fieldName = "PEER_ROLE_RELAY";
break;
case ZT_PEER_ROLE_ROOT:
@@ -313,11 +313,20 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
return NULL;
}
- jobject inetAddressObject = newInetAddress(env, addr);
+ jobject inetAddressObject = NULL;
+
+ if(addr.ss_family != 0)
+ {
+ inetAddressObject = newInetAddress(env, addr);
- if(env->ExceptionCheck() || inetAddressObject == NULL)
+ if(env->ExceptionCheck() || inetAddressObject == NULL)
+ {
+ LOGE("Error creating new inet address");
+ return NULL;
+ }
+ }
+ else
{
- LOGE("Error creating new inet address");
return NULL;
}
@@ -350,10 +359,9 @@ jobject newInetSocketAddress(JNIEnv *env, const sockaddr_storage &addr)
break;
default:
{
- LOGE("ERROR: addr.ss_family is not set or unknown");
break;
}
- };
+ }
jobject inetSocketAddressObject = env->NewObject(inetSocketAddressClass, inetSocketAddress_constructor, inetAddressObject, port);
@@ -889,14 +897,14 @@ jobject newVirtualNetworkRoute(JNIEnv *env, const ZT_VirtualNetworkRoute &route)
jfieldID metricField = NULL;
targetField = lookup.findField(virtualNetworkRouteClass, "target",
- "Ljava/net/InetSocketAddress");
+ "Ljava/net/InetSocketAddress;");
if(env->ExceptionCheck() || targetField == NULL)
{
return NULL;
}
viaField = lookup.findField(virtualNetworkRouteClass, "via",
- "Ljava/net/InetSocketAddress");
+ "Ljava/net/InetSocketAddress;");
if(env->ExceptionCheck() || targetField == NULL)
{
return NULL;