mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
fix packet sending functions
This commit is contained in:
parent
d8f1c3dff7
commit
512c3af4ea
2 changed files with 16 additions and 5 deletions
|
@ -443,11 +443,22 @@ namespace {
|
||||||
|
|
||||||
LOGV("Calling onDataStoreGet(%s, %p)", p, buffer);
|
LOGV("Calling onDataStoreGet(%s, %p)", p, buffer);
|
||||||
|
|
||||||
return (int)env->CallLongMethod(
|
int retval = (int)env->CallLongMethod(
|
||||||
ref->dataStoreGetListener,
|
ref->dataStoreGetListener,
|
||||||
dataStoreGetCallbackMethod,
|
dataStoreGetCallbackMethod,
|
||||||
nameStr,
|
nameStr,
|
||||||
bufferObj);
|
bufferObj);
|
||||||
|
|
||||||
|
LOGV("onDataStoreGet returned %d", retval);
|
||||||
|
|
||||||
|
if(retval > 0)
|
||||||
|
{
|
||||||
|
void *data = env->GetPrimitiveArrayCritical(bufferObj, NULL);
|
||||||
|
memcpy(buffer, data, retval);
|
||||||
|
env->ReleasePrimitiveArrayCritical(bufferObj, data, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int WirePacketSendFunction(ZT_Node *node,
|
int WirePacketSendFunction(ZT_Node *node,
|
||||||
|
@ -459,7 +470,7 @@ namespace {
|
||||||
unsigned int bufferSize,
|
unsigned int bufferSize,
|
||||||
unsigned int ttl)
|
unsigned int ttl)
|
||||||
{
|
{
|
||||||
LOGV("WirePacketSendFunction(%ld, %p, %p, %d)", localSocket, remoteAddress, buffer, bufferSize);
|
LOGV("WirePacketSendFunction(%lld, %p, %p, %d)", (long long)localSocket, remoteAddress, buffer, bufferSize);
|
||||||
JniRef *ref = (JniRef*)userData;
|
JniRef *ref = (JniRef*)userData;
|
||||||
assert(ref->node == node);
|
assert(ref->node == node);
|
||||||
|
|
||||||
|
|
|
@ -173,12 +173,12 @@ public class Node {
|
||||||
*/
|
*/
|
||||||
public ResultCode processWirePacket(
|
public ResultCode processWirePacket(
|
||||||
long now,
|
long now,
|
||||||
InetSocketAddress localAddress,
|
long localSocket,
|
||||||
InetSocketAddress remoteAddress,
|
InetSocketAddress remoteAddress,
|
||||||
byte[] packetData,
|
byte[] packetData,
|
||||||
long[] nextBackgroundTaskDeadline) {
|
long[] nextBackgroundTaskDeadline) {
|
||||||
return processWirePacket(
|
return processWirePacket(
|
||||||
nodeId, now, localAddress, remoteAddress, packetData,
|
nodeId, now, localSocket, remoteAddress, packetData,
|
||||||
nextBackgroundTaskDeadline);
|
nextBackgroundTaskDeadline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ public class Node {
|
||||||
private native ResultCode processWirePacket(
|
private native ResultCode processWirePacket(
|
||||||
long nodeId,
|
long nodeId,
|
||||||
long now,
|
long now,
|
||||||
InetSocketAddress localAddress,
|
long localSocket,
|
||||||
InetSocketAddress remoteAddress,
|
InetSocketAddress remoteAddress,
|
||||||
byte[] packetData,
|
byte[] packetData,
|
||||||
long[] nextBackgroundTaskDeadline);
|
long[] nextBackgroundTaskDeadline);
|
||||||
|
|
Loading…
Add table
Reference in a new issue