From 0508a41afddce1b81921a0eeb9e03f28d0f04742 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Sat, 14 Nov 2015 17:40:17 -0800 Subject: [PATCH 1/2] added ttl parameter to WirePacketSendFunction --- java/jni/com_zerotierone_sdk_Node.cpp | 5 +++-- java/src/com/zerotier/sdk/PacketSender.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/java/jni/com_zerotierone_sdk_Node.cpp b/java/jni/com_zerotierone_sdk_Node.cpp index 17a9917a9..2c1b68071 100644 --- a/java/jni/com_zerotierone_sdk_Node.cpp +++ b/java/jni/com_zerotierone_sdk_Node.cpp @@ -427,7 +427,8 @@ namespace { const struct sockaddr_storage *localAddress, const struct sockaddr_storage *remoteAddress, const void *buffer, - unsigned int bufferSize) + unsigned int bufferSize, + unsigned int ttl) { LOGV("WirePacketSendFunction(%p, %p, %p, %d)", localAddress, remoteAddress, buffer, bufferSize); JniRef *ref = (JniRef*)userData; @@ -445,7 +446,7 @@ namespace { } jmethodID packetSenderCallbackMethod = lookup.findMethod(packetSenderClass, - "onSendPacketRequested", "(Ljava/net/InetSocketAddress;Ljava/net/InetSocketAddress;[B)I"); + "onSendPacketRequested", "(Ljava/net/InetSocketAddress;Ljava/net/InetSocketAddress;[BI)I"); if(packetSenderCallbackMethod == NULL) { LOGE("Couldn't find onSendPacketRequested method"); diff --git a/java/src/com/zerotier/sdk/PacketSender.java b/java/src/com/zerotier/sdk/PacketSender.java index ab31729be..22893ec73 100644 --- a/java/src/com/zerotier/sdk/PacketSender.java +++ b/java/src/com/zerotier/sdk/PacketSender.java @@ -45,5 +45,6 @@ public interface PacketSender { public int onSendPacketRequested( InetSocketAddress localAddr, InetSocketAddress remoteAddr, - byte[] packetData); + byte[] packetData, + int ttl); } From 75f8ee1b9c25403b7fbd42b901d98ddbce7f89f5 Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Sat, 14 Nov 2015 18:19:33 -0800 Subject: [PATCH 2/2] =?UTF-8?q?get=20the=20compiler=20to=20stop=20complain?= =?UTF-8?q?ing=20about=20two=20string=20literals=20(one=20a=20macro)=20nex?= =?UTF-8?q?t=20to=20each=20other=20without=20an=20intervening=20space?= =?UTF-8?q?=E2=80=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- node/Topology.cpp | 4 ++-- node/Topology.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/node/Topology.cpp b/node/Topology.cpp index 1617dd94f..3d1db3379 100644 --- a/node/Topology.cpp +++ b/node/Topology.cpp @@ -128,8 +128,8 @@ SharedPtr Topology::addPeer(const SharedPtr &peer) #ifdef ZT_TRACE if ((!peer)||(peer->address() == RR->identity.address())) { if (!peer) - fprintf(stderr,"FATAL BUG: addPeer() caught attempt to add NULL peer"ZT_EOL_S); - else fprintf(stderr,"FATAL BUG: addPeer() caught attempt to add peer for self"ZT_EOL_S); + fprintf(stderr,"FATAL BUG: addPeer() caught attempt to add NULL peer" ZT_EOL_S); + else fprintf(stderr,"FATAL BUG: addPeer() caught attempt to add peer for self" ZT_EOL_S); abort(); } #endif diff --git a/node/Topology.hpp b/node/Topology.hpp index a9a5f2f99..07daa2764 100644 --- a/node/Topology.hpp +++ b/node/Topology.hpp @@ -239,7 +239,7 @@ public: while (i.next(a,p)) { #ifdef ZT_TRACE if (!(*p)) { - fprintf(stderr,"FATAL BUG: eachPeer() caught NULL peer for %s -- peer pointers in Topology should NEVER be NULL"ZT_EOL_S,a->toString().c_str()); + fprintf(stderr,"FATAL BUG: eachPeer() caught NULL peer for %s -- peer pointers in Topology should NEVER be NULL" ZT_EOL_S,a->toString().c_str()); abort(); } #endif