CitiesSkylinesMultiplayer / CSM

Source code for the Cities: Skylines Multiplayer mod (CSM)
https://citiesskylinesmultiplayer.com/
MIT License
728 stars 94 forks source link

Server not Joinable by Client #282

Closed KarmaLN closed 2 years ago

KarmaLN commented 2 years ago

Description: On the newest Update of CSM Clients can not join the Host it returns an Error for the Host (Error while parsing command, see log)

Steps to reproduce the behavior:

  1. Join Server as Client or have Client join your Server

Expected behavior Connect without Issues/Error

Active DLCs -None

Active mods -Harmony 2.2-0 -Cities Skylines Multiplayer (CSM)

Versions

Additional context

Log File Encountered an error while reading command from (Joining Client IPADDRESS):: System.ArgumentNullException: Argument cannot be null. Parameter name: first at System.Linq.Check.FirstAndSecond (System.Object first, System.Object second) [0x00000] in <filename unknown>:0 at System.Linq.Enumerable.SequenceEqual[String] (IEnumerable1 first, IEnumerable1 second, IEqualityComparer1 comparer) [0x00000] in <filename unknown>:0 at System.Linq.Enumerable.SequenceEqual[String] (IEnumerable1 first, IEnumerable1 second) [0x00000] in <filename unknown>:0 at CSM.Commands.Handler.Internal.ConnectionRequestHandler.HandleOnServer (CSM.Commands.Data.Internal.ConnectionRequestCommand command, LiteNetLib.NetPeer peer) [0x00000] in <filename unknown>:0 at CSM.Commands.CommandReceiver.Parse (LiteNetLib.NetPacketReader reader, LiteNetLib.NetPeer peer) [0x00000] in <filename unknown>:0 at CSM.Networking.Server.ListenerOnNetworkReceiveEvent (LiteNetLib.NetPeer peer, LiteNetLib.NetPacketReader reader, DeliveryMethod deliveryMethod) [0x00000] in <filename unknown>:0

-Multiple people have reported this on the Discord so I doubt its a isolated Case

DominicMaas commented 2 years ago

hmmm, maybe something to do with the ConnectionRequestCommand (more specifically ConnectionRequestHandler), and running SequenceEqual on the mods. The mods list may be null from the client?

DominicMaas commented 2 years ago

I assume the host is running the same version as the client?

chrisi51 commented 2 years ago

on my side both are on the same game/mod version but one is using windows the other one is on mac ...

and we are on LAN ... so portforwarding shouldnd be the issue

[21:08:42.4409] [Info] Attempting to start server on port 4230...
[21:08:43.6909] [Info] The server has started.
[21:08:46.8958] [Warn] It was tried to forward the port automatically, but the server is not reachable from the internet. Manual port forwarding is required.
[21:08:47.2908] [Info] Received connection request.
[21:08:47.2938] [Except] Encountered an error while reading command from 192.168.1.93:60929:: System.ArgumentNullException: Argument cannot be null.
Parameter name: first
  at System.Linq.Check.FirstAndSecond (System.Object first, System.Object second) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.SequenceEqual[String] (IEnumerable`1 first, IEnumerable`1 second, IEqualityComparer`1 comparer) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.SequenceEqual[String] (IEnumerable`1 first, IEnumerable`1 second) [0x00000] in <filename unknown>:0 
  at CSM.Commands.Handler.Internal.ConnectionRequestHandler.HandleOnServer (CSM.Commands.Data.Internal.ConnectionRequestCommand command, LiteNetLib.NetPeer peer) [0x00000] in <filename unknown>:0 
  at CSM.Commands.CommandReceiver.Parse (LiteNetLib.NetPacketReader reader, LiteNetLib.NetPeer peer) [0x00000] in <filename unknown>:0 
  at CSM.Networking.Server.ListenerOnNetworkReceiveEvent (LiteNetLib.NetPeer peer, LiteNetLib.NetPacketReader reader, DeliveryMethod deliveryMethod) [0x00000] in <filename unknown>:0 
DominicMaas commented 2 years ago

yeah not a networking issue, I think it has to do with parsing the mods list

KarmaLN commented 2 years ago

Mine came from Windows (Host) and Linux (Client) using Portforwarding with same versions game and mod

chrisi51 commented 2 years ago

if it helps in any way ... on windows the log was well formatted while on mac the log is without linebreaks ... so maybe unix/windows missmatch on linebreaks?

kaenganxt commented 2 years ago

I just tested an assumption I had. When the list of mods is empty, protobuf seems to send null to the other side, which then causes the issue. Fix coming up shortly :)

DominicMaas commented 2 years ago

if it helps in any way ... on windows the log was well formatted while on mac the log is without linebreaks ... so maybe unix/windows missmatch on linebreaks?

Yeah, looks like the new line character needs to be different on unix platforms, will have to see how you detect that in mono (separate issue though)

chrisi51 commented 2 years ago

I just tested an assumption I had. When the list of mods is empty, protobuf seems to send null to the other side, which then causes the issue. Fix coming up shortly :)

was thinking the same but didnt had same content on both machines for testing it xD