-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetworkManager.DisconnectReason is always Empty String #2389
Comments
@Reag I am going to mark this as a feature request since I can see a few spots where we could populate this string with known disconnection reasons (time out, client stopped/disconnected itself, and I think we might be able to determine if the transport just loses the connection...which would be a "connection interruption"). |
Would definitely be useful. The tooltip from Intellisense lead me to believe that this property would always be populated with a disconnect reason. Both of my reports stem from a few hours of trying to track down the reason for a client disconnect. It turns out that after I fixed up a bad RPC, the scene had no network event traffic for idle clients. As, for some reason, the heartbeat in the project was misconfigured to be longer than the timeout, it lead to the clients disconnecting. However, I had no way to tell this (I only recieved a generic disconnect message from the console), and spent a few hours with wireshark and the unity debugger as a result. Some kind of way of telling 'why' a client disconnected would definitely be a useful feature for me as a developer using this feature. |
@Reag |
I am trying to use this with the connection approval process:
My client indeed gets disconnected but the NetworkManager.Singleton.DisconnectReason returns an empty string on the client side. Am I missing sth? Update: This happens when using Facepunch Transport. If I use Unity Transport, it works fine. |
@cantaspinar If that is the third party library you are using, then you might file a github issue there. |
I have been using the community facepunch transport. I have also tried the other community transport called SteamNetworkingSockets. Same issue with that one as well. :/ Btw, I am just selecting the transport in the Netcode's NetworkManager component. Not using a custom NetworkManager implementation. I have created 2 issues |
Ahh... sorry about that misunderstanding. So, you are checking the client-side's NetworkManager.DisconnectReason and that is either null or String.Empty when the client is not approved and disconnected? |
That is correct. It also appears like both transports does not terminate the connection properly? Facepunch goes to a timeout and the SteamNetworkingSockets gives this error: Can't disconect client, client not connected, clientId: XXXXXX |
So here is the delta between UnityTransport and the community Facepunch:
The community Facepunch source code looks like it just closes the connection:
So, I am going to bet that is why the disconnect message isn't sent. On the client side, the transport level "disconnect" event is what is most likely happening (which will not have that message). Hmm... |
@cantaspinar
|
It worked out, huge thanks! I can get the disconnect messages on the client side now. I still get the following error though when approved is set to false.
To be clear, I was getting this error before your modification too. It doesn't seem to break anything else though. This error comes after 10 seconds, which is the default Client Connection Buffer Timeout duration I guess. |
@cantaspinar This happens on the server or client side? |
@cantaspinar |
Right, I had a look at the call trace and I guess this is the place. (NetworkManager, Line 1737)
I guess the Unity transport is handling this as well? |
@cantaspinar |
Description
The variable NetworkManager.DisconnectReason is always empty. The code that sets this variable in the NetworkManager is never activated with UTP.
Reproduce Steps
Actual Outcome
Breakpoint that sets the DisconnectReason is never tripped, leaving the variable as empty string
Expected Outcome
The variable will get some information about why the server disconnected the client
Environment
The text was updated successfully, but these errors were encountered: