mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
LLAPITransport receive: don't return if error != 0 because it's part of the disconnect message. fixes a bug where disconnect wasn never received on client/server.
This commit is contained in:
parent
bbdb045c6d
commit
4f89f8182b
@ -108,11 +108,16 @@ public bool ClientGetNextMessage(out TransportEvent transportEvent, out byte[] d
|
|||||||
int receivedSize;
|
int receivedSize;
|
||||||
NetworkEventType networkEvent = NetworkTransport.ReceiveFromHost(clientId, out connectionId, out channel, clientReceiveBuffer, clientReceiveBuffer.Length, out receivedSize, out error);
|
NetworkEventType networkEvent = NetworkTransport.ReceiveFromHost(clientId, out connectionId, out channel, clientReceiveBuffer, clientReceiveBuffer.Length, out receivedSize, out error);
|
||||||
|
|
||||||
|
// note: 'error' is used for extra information, e.g. the reason for
|
||||||
|
// a disconnect. we don't necessarily have to throw an error if
|
||||||
|
// error != 0. but let's log it for easier debugging.
|
||||||
|
//
|
||||||
|
// DO NOT return after error != 0. otherwise Disconnect won't be
|
||||||
|
// registered.
|
||||||
NetworkError networkError = (NetworkError)error;
|
NetworkError networkError = (NetworkError)error;
|
||||||
if (networkError != NetworkError.Ok)
|
if (networkError != NetworkError.Ok)
|
||||||
{
|
{
|
||||||
Debug.LogError("NetworkTransport.Receive failed: hostid=" + clientId + " connId=" + connectionId + " channelId=" + channel + " error=" + networkError);
|
Debug.Log("NetworkTransport.Receive failed: hostid=" + clientId + " connId=" + connectionId + " channelId=" + channel + " error=" + networkError);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (networkEvent)
|
switch (networkEvent)
|
||||||
@ -186,11 +191,16 @@ public bool ServerGetNextMessage(out int connectionId, out TransportEvent transp
|
|||||||
int receivedSize;
|
int receivedSize;
|
||||||
NetworkEventType networkEvent = NetworkTransport.ReceiveFromHost(serverHostId, out connectionId, out channel, serverReceiveBuffer, serverReceiveBuffer.Length, out receivedSize, out error);
|
NetworkEventType networkEvent = NetworkTransport.ReceiveFromHost(serverHostId, out connectionId, out channel, serverReceiveBuffer, serverReceiveBuffer.Length, out receivedSize, out error);
|
||||||
|
|
||||||
|
// note: 'error' is used for extra information, e.g. the reason for
|
||||||
|
// a disconnect. we don't necessarily have to throw an error if
|
||||||
|
// error != 0. but let's log it for easier debugging.
|
||||||
|
//
|
||||||
|
// DO NOT return after error != 0. otherwise Disconnect won't be
|
||||||
|
// registered.
|
||||||
NetworkError networkError = (NetworkError)error;
|
NetworkError networkError = (NetworkError)error;
|
||||||
if (networkError != NetworkError.Ok)
|
if (networkError != NetworkError.Ok)
|
||||||
{
|
{
|
||||||
Debug.LogError("NetworkTransport.Receive failed: hostid=" + serverHostId + " connId=" + connectionId + " channelId=" + channel + " error=" + networkError);
|
Debug.Log("NetworkTransport.Receive failed: hostid=" + serverHostId + " connId=" + connectionId + " channelId=" + channel + " error=" + networkError);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LLAPI client sends keep alive messages (75-6C-6C) on channel=110.
|
// LLAPI client sends keep alive messages (75-6C-6C) on channel=110.
|
||||||
|
Loading…
Reference in New Issue
Block a user