mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-02 22:16:13 +00:00
Working ENet with new common jar and modified ENet library
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,3 +1,3 @@
|
|||||||
[submodule "app/src/main/jni/jnienet/enet"]
|
[submodule "app/src/main/jni/jnienet/enet"]
|
||||||
path = 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 not shown.
Binary file not shown.
Submodule app/src/main/jni/jnienet/enet updated: 4d1067179b...4f7ef11c23
@@ -30,7 +30,7 @@ Java_com_limelight_nvstream_enet_EnetConnection_connectToPeer(JNIEnv *env, jobje
|
|||||||
// Initialize the ENet address
|
// Initialize the ENet address
|
||||||
addrStr = (*env)->GetStringUTFChars(env, address, 0);
|
addrStr = (*env)->GetStringUTFChars(env, address, 0);
|
||||||
enet_address_set_host(&enetAddress, addrStr);
|
enet_address_set_host(&enetAddress, addrStr);
|
||||||
enetAddress.port = port;
|
enet_address_set_port(&enetAddress, port);
|
||||||
(*env)->ReleaseStringUTFChars(env, address, addrStr);
|
(*env)->ReleaseStringUTFChars(env, address, addrStr);
|
||||||
|
|
||||||
// Start the connection
|
// Start the connection
|
||||||
@@ -47,6 +47,9 @@ Java_com_limelight_nvstream_enet_EnetConnection_connectToPeer(JNIEnv *env, jobje
|
|||||||
|
|
||||||
// Ensure the connect verify ACK is sent immediately
|
// Ensure the connect verify ACK is sent immediately
|
||||||
enet_host_flush(LONG_TO_CLIENT(client));
|
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);
|
return PEER_TO_LONG(peer);
|
||||||
}
|
}
|
||||||
@@ -68,7 +71,8 @@ Java_com_limelight_nvstream_enet_EnetConnection_readPacket(JNIEnv *env, jobject
|
|||||||
|
|
||||||
// Check that the packet isn't too large
|
// Check that the packet isn't too large
|
||||||
if (event.packet->dataLength > length) {
|
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
|
// Copy the packet data into the caller's buffer
|
||||||
|
|||||||
Reference in New Issue
Block a user