Issues with SessionList and GetProtocolToken()
Options
LemurDev
✭
in Photon Bolt
I am using Photon Bolt and having some issues when using BoltNetwork.SessionList and also GetProtocolToken().
I have a headless server instance which is starting and calling BoltLauncher.StartServer(). The server then registers PhotonRoomProperties as a token class in BoltStartBegin, and creates a new PhotonRoomProperties instance in BoltStartDone (with a couple properties added, one string one int). IsOpen and IsVisible are set to true. Finally, server calls BoltMatchmaking.CreateSession and passes in the scene to load, an ID, and the token I just created.
My issue, is that SessionList is unreliably updated when this server startup is complete. Sometimes, a client which is subsequently started using BoltLauncher.StartClient() will never see the session in the session list. Sometimes it will. It's random, but probably close to 50/50 chance. Repeatedly closing both client and server and starting again will sometimes lead to client seeing the session in SessionList.
In addition to this, whenever I DO find the created session in SessionList, calling GetProtocolToken on it will raise an IndexOutOfRangeException. Full stack trace below:
I have a headless server instance which is starting and calling BoltLauncher.StartServer(). The server then registers PhotonRoomProperties as a token class in BoltStartBegin, and creates a new PhotonRoomProperties instance in BoltStartDone (with a couple properties added, one string one int). IsOpen and IsVisible are set to true. Finally, server calls BoltMatchmaking.CreateSession and passes in the scene to load, an ID, and the token I just created.
My issue, is that SessionList is unreliably updated when this server startup is complete. Sometimes, a client which is subsequently started using BoltLauncher.StartClient() will never see the session in the session list. Sometimes it will. It's random, but probably close to 50/50 chance. Repeatedly closing both client and server and starting again will sometimes lead to client seeing the session in SessionList.
In addition to this, whenever I DO find the created session in SessionList, calling GetProtocolToken on it will raise an IndexOutOfRangeException. Full stack trace below:
IndexOutOfRangeException: Index was outside the bounds of the array. UdpKit.UdpPacket.InternalReadByte (System.Int32 bits) (at <c4ae73ae75084feaa73163672d7da255>:0) UdpKit.UdpPacket.ReadUShort (System.Int32 bits) (at <c4ae73ae75084feaa73163672d7da255>:0) UdpKit.UdpPacket.ReadUShort () (at <c4ae73ae75084feaa73163672d7da255>:0) UdpKit.UdpPacket.ReadString (System.Text.Encoding encoding) (at <c4ae73ae75084feaa73163672d7da255>:0) UdpKit.UdpPacket.ReadString () (at <c4ae73ae75084feaa73163672d7da255>:0) Bolt.Tokens.BoltDisconnectToken.Read (UdpKit.UdpPacket packet) (at <91e633532a7e4582a260e897276e2d36>:0) Bolt.ProtocolTokenUtils.ToToken (System.Byte[] bytes) (at <91e633532a7e4582a260e897276e2d36>:0) Bolt.Utils.BoltUtils.GetProtocolToken (UdpKit.UdpSession session) (at <91e633532a7e4582a260e897276e2d36>:0)
0
Comments
-
Hello @LemurDev ,
Which Bolt version are you using?
You are able to reproduce this using the Getting Started sample the comes with the SDK?
Following your instructions, we were not able to reproduce your behavior.
1. Register token: https://github.com/BoltEngine/Bolt-Sample/blob/master/GettingStarted/Scripts/Menu.cs#L53
2. Create session with token: https://github.com/BoltEngine/Bolt-Sample/blob/master/GettingStarted/Scripts/Menu.cs#L84
3. Start client: https://github.com/BoltEngine/Bolt-Sample/blob/master/GettingStarted/Scripts/Menu.cs#L44
4. Get session properties: https://github.com/BoltEngine/Bolt-Sample/blob/master/GettingStarted/Scripts/Menu.cs#L121
The same structure you described is found on the "Menu.cs" script of the Getting Started sample, including:PhotonRoomProperties token = (PhotonRoomProperties) photonSession.GetProtocolToken();
On the line https://github.com/BoltEngine/Bolt-Sample/blob/master/GettingStarted/Scripts/Menu.cs#L120 would trigger the issue you are seeing, which is not the case.
--
Ramon Melo
Photon Bolt Team0 -
Ramon,
I updated my Bolt instance to the latest version, which seems to have resolved the issue with SessionList being inconsistent. I can get the protocol token to work if I convert the UdpSession to PhotonSession and use Properties.TryGetValue, but calling GetProtocolToken() on it still gives me an IndexOutOfRangeException like before.0