fix for reconnection bug that only happened on quest resulting in an instacrash
parent
40a863cf15
commit
bca55cccbc
|
|
@ -101,6 +101,7 @@ namespace VelNet
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public bool connected;
|
public bool connected;
|
||||||
|
private bool wasConnected;
|
||||||
private double lastConnectionCheck;
|
private double lastConnectionCheck;
|
||||||
|
|
||||||
public List<NetworkObject> prefabs = new List<NetworkObject>();
|
public List<NetworkObject> prefabs = new List<NetworkObject>();
|
||||||
|
|
@ -273,6 +274,11 @@ namespace VelNet
|
||||||
}
|
}
|
||||||
case LoginMessage lm:
|
case LoginMessage lm:
|
||||||
{
|
{
|
||||||
|
if (userid == lm.userId)
|
||||||
|
{
|
||||||
|
Debug.Log("Received duplicate login message " + userid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
userid = lm.userId;
|
userid = lm.userId;
|
||||||
Debug.Log("Joined server " + userid);
|
Debug.Log("Joined server " + userid);
|
||||||
|
|
||||||
|
|
@ -511,8 +517,9 @@ namespace VelNet
|
||||||
|
|
||||||
if (Time.timeAsDouble - lastConnectionCheck > 2)
|
if (Time.timeAsDouble - lastConnectionCheck > 2)
|
||||||
{
|
{
|
||||||
if (!IsConnected)
|
if (!IsConnected && wasConnected)
|
||||||
{
|
{
|
||||||
|
Debug.Log("Reconnecting...");
|
||||||
ConnectToServer();
|
ConnectToServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -806,6 +813,7 @@ namespace VelNet
|
||||||
}
|
}
|
||||||
|
|
||||||
udpConnected = true;
|
udpConnected = true;
|
||||||
|
wasConnected = true;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int numReceived = udpSocket.Receive(buffer);
|
int numReceived = udpSocket.Receive(buffer);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "edu.uga.engr.vel.velnet",
|
"name": "edu.uga.engr.vel.velnet",
|
||||||
"displayName": "VelNet",
|
"displayName": "VelNet",
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"unity": "2019.1",
|
"unity": "2019.1",
|
||||||
"description": "A custom networking library for Unity.",
|
"description": "A custom networking library for Unity.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue