Skip to content

Commit

Permalink
Working ENet with new common jar and modified ENet library
Browse files Browse the repository at this point in the history
  • Loading branch information
cgutman committed Mar 6, 2016
1 parent 06822ad commit 44a0ae8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
@@ -1,3 +1,3 @@
[submodule "app/src/main/jni/jnienet/enet"]
path = app/src/main/jni/jnienet/enet
url = https://github.com/lsalzman/enet.git
url = https://github.com/cgutman/enet.git
Binary file modified app/libs/limelight-common.jar
Binary file not shown.
Binary file modified app/libs/tinyrtsp.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/jni/jnienet/enet
Submodule enet updated 6 files
+1 −27 host.c
+11 −43 include/enet/enet.h
+1 −0 include/enet/win32.h
+7 −11 protocol.c
+80 −168 unix.c
+93 −106 win32.c
8 changes: 6 additions & 2 deletions app/src/main/jni/jnienet/jnienet.c
Expand Up @@ -30,7 +30,7 @@ Java_com_limelight_nvstream_enet_EnetConnection_connectToPeer(JNIEnv *env, jobje
// Initialize the ENet address
addrStr = (*env)->GetStringUTFChars(env, address, 0);
enet_address_set_host(&enetAddress, addrStr);
enetAddress.port = port;
enet_address_set_port(&enetAddress, port);
(*env)->ReleaseStringUTFChars(env, address, addrStr);

// Start the connection
Expand All @@ -47,6 +47,9 @@ Java_com_limelight_nvstream_enet_EnetConnection_connectToPeer(JNIEnv *env, jobje

// Ensure the connect verify ACK is sent immediately
enet_host_flush(LONG_TO_CLIENT(client));

// Set the max peer timeout to 10 seconds
enet_peer_timeout(peer, ENET_PEER_TIMEOUT_LIMIT, ENET_PEER_TIMEOUT_MINIMUM, 10000);

return PEER_TO_LONG(peer);
}
Expand All @@ -68,7 +71,8 @@ Java_com_limelight_nvstream_enet_EnetConnection_readPacket(JNIEnv *env, jobject

// Check that the packet isn't too large
if (event.packet->dataLength > length) {
return -1;
enet_packet_destroy(event.packet);
return event.packet->dataLength;
}

// Copy the packet data into the caller's buffer
Expand Down

0 comments on commit 44a0ae8

Please sign in to comment.