mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +00:00
Fail writePacket if enet_peer_send returns -1
This commit is contained in:
parent
94ee24ea11
commit
ceef00b79a
@ -99,9 +99,16 @@ Java_com_limelight_nvstream_enet_EnetConnection_writePacket(JNIEnv *env, jobject
|
|||||||
packet = enet_packet_create(dataPtr, length, packetFlags);
|
packet = enet_packet_create(dataPtr, length, packetFlags);
|
||||||
if (packet != NULL) {
|
if (packet != NULL) {
|
||||||
// Send the message to the peer
|
// Send the message to the peer
|
||||||
enet_peer_send(LONG_TO_PEER(peer), 0, packet);
|
if (enet_peer_send(LONG_TO_PEER(peer), 0, packet) < 0) {
|
||||||
enet_host_flush(LONG_TO_CLIENT(client));
|
// This can fail if the peer has been disconnected
|
||||||
ret = JNI_TRUE;
|
enet_packet_destroy(packet);
|
||||||
|
ret = JNI_FALSE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Force the client to send the packet now
|
||||||
|
enet_host_flush(LONG_TO_CLIENT(client));
|
||||||
|
ret = JNI_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = JNI_FALSE;
|
ret = JNI_FALSE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user