mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-17 14:48:17 +00:00
make PeerPhysicalPath a plain data class
This commit is contained in:
@ -114,10 +114,6 @@ jmethodID VirtualNetworkType_fromInt_method;
|
||||
// Instance fields
|
||||
//
|
||||
|
||||
jfieldID PeerPhysicalPath_address_field;
|
||||
jfieldID PeerPhysicalPath_lastReceive_field;
|
||||
jfieldID PeerPhysicalPath_lastSend_field;
|
||||
jfieldID PeerPhysicalPath_preferred_field;
|
||||
jfieldID Peer_address_field;
|
||||
jfieldID Peer_latency_field;
|
||||
jfieldID Peer_paths_field;
|
||||
@ -211,7 +207,7 @@ void setupJNICache(JavaVM *vm) {
|
||||
EXCEPTIONANDNULLCHECK(PacketSender_onSendPacketRequested_method = env->GetMethodID(PacketSender_class, "onSendPacketRequested", "(JLjava/net/InetSocketAddress;[BI)I"));
|
||||
EXCEPTIONANDNULLCHECK(PathChecker_onPathCheck_method = env->GetMethodID(PathChecker_class, "onPathCheck", "(JJLjava/net/InetSocketAddress;)Z"));
|
||||
EXCEPTIONANDNULLCHECK(PathChecker_onPathLookup_method = env->GetMethodID(PathChecker_class, "onPathLookup", "(JI)Ljava/net/InetSocketAddress;"));
|
||||
EXCEPTIONANDNULLCHECK(PeerPhysicalPath_ctor = env->GetMethodID(PeerPhysicalPath_class, "<init>", "()V"));
|
||||
EXCEPTIONANDNULLCHECK(PeerPhysicalPath_ctor = env->GetMethodID(PeerPhysicalPath_class, "<init>", "(Ljava/net/InetSocketAddress;JJZZ)V"));
|
||||
EXCEPTIONANDNULLCHECK(Peer_ctor = env->GetMethodID(Peer_class, "<init>", "()V"));
|
||||
EXCEPTIONANDNULLCHECK(Version_ctor = env->GetMethodID(Version_class, "<init>", "()V"));
|
||||
EXCEPTIONANDNULLCHECK(VirtualNetworkConfigListener_onNetworkConfigurationUpdated_method = env->GetMethodID(VirtualNetworkConfigListener_class, "onNetworkConfigurationUpdated", "(JLcom/zerotier/sdk/VirtualNetworkConfigOperation;Lcom/zerotier/sdk/VirtualNetworkConfig;)I"));
|
||||
@ -236,10 +232,6 @@ void setupJNICache(JavaVM *vm) {
|
||||
// Instance fields
|
||||
//
|
||||
|
||||
EXCEPTIONANDNULLCHECK(PeerPhysicalPath_address_field = env->GetFieldID(PeerPhysicalPath_class, "address", "Ljava/net/InetSocketAddress;"));
|
||||
EXCEPTIONANDNULLCHECK(PeerPhysicalPath_lastReceive_field = env->GetFieldID(PeerPhysicalPath_class, "lastReceive", "J"));
|
||||
EXCEPTIONANDNULLCHECK(PeerPhysicalPath_lastSend_field = env->GetFieldID(PeerPhysicalPath_class, "lastSend", "J"));
|
||||
EXCEPTIONANDNULLCHECK(PeerPhysicalPath_preferred_field = env->GetFieldID(PeerPhysicalPath_class, "preferred", "Z"));
|
||||
EXCEPTIONANDNULLCHECK(Peer_address_field = env->GetFieldID(Peer_class, "address", "J"));
|
||||
EXCEPTIONANDNULLCHECK(Peer_latency_field = env->GetFieldID(Peer_class, "latency", "I"));
|
||||
EXCEPTIONANDNULLCHECK(Peer_paths_field = env->GetFieldID(Peer_class, "paths", "[Lcom/zerotier/sdk/PeerPhysicalPath;"));
|
||||
|
@ -83,10 +83,6 @@ extern jmethodID VirtualNetworkType_fromInt_method;
|
||||
// Instance fields
|
||||
//
|
||||
|
||||
extern jfieldID PeerPhysicalPath_address_field;
|
||||
extern jfieldID PeerPhysicalPath_lastReceive_field;
|
||||
extern jfieldID PeerPhysicalPath_lastSend_field;
|
||||
extern jfieldID PeerPhysicalPath_preferred_field;
|
||||
extern jfieldID Peer_address_field;
|
||||
extern jfieldID Peer_latency_field;
|
||||
extern jfieldID Peer_paths_field;
|
||||
|
@ -201,26 +201,23 @@ jobject newPeerPhysicalPath(JNIEnv *env, const ZT_PeerPhysicalPath &ppp)
|
||||
{
|
||||
LOGV("newPeerPhysicalPath Called");
|
||||
|
||||
jobject pppObject = env->NewObject(PeerPhysicalPath_class, PeerPhysicalPath_ctor);
|
||||
if(env->ExceptionCheck() || pppObject == NULL)
|
||||
{
|
||||
LOGE("Error creating PPP object");
|
||||
return NULL; // out of memory
|
||||
}
|
||||
|
||||
jobject addressObject = newInetSocketAddress(env, ppp.address);
|
||||
if(env->ExceptionCheck() || addressObject == NULL) {
|
||||
LOGE("Error creating InetSocketAddress object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
env->SetObjectField(pppObject, PeerPhysicalPath_address_field, addressObject);
|
||||
env->SetLongField(pppObject, PeerPhysicalPath_lastSend_field, ppp.lastSend);
|
||||
env->SetLongField(pppObject, PeerPhysicalPath_lastReceive_field, ppp.lastReceive);
|
||||
env->SetBooleanField(pppObject, PeerPhysicalPath_preferred_field, ppp.preferred);
|
||||
|
||||
if(env->ExceptionCheck()) {
|
||||
LOGE("Exception assigning fields to PeerPhysicalPath object");
|
||||
jobject pppObject = env->NewObject(
|
||||
PeerPhysicalPath_class,
|
||||
PeerPhysicalPath_ctor,
|
||||
addressObject,
|
||||
ppp.lastSend,
|
||||
ppp.lastReceive,
|
||||
ppp.preferred);
|
||||
if(env->ExceptionCheck() || pppObject == NULL)
|
||||
{
|
||||
LOGE("Error creating PPP object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pppObject;
|
||||
|
Reference in New Issue
Block a user