Rezlind
Member-
Posts
82 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Everything posted by Rezlind
-
Hi everyone, For some context I've been upgrading Cpt Sky's Copsv6 enhanced version from 4330 to 5017. It's been a really great learning experience thus far and actually having a server to practice on has helped fulfill my understanding of how conquer works faster and better than just reading about it. So far I've upgraded pretty much every packet that was changed (and have some notes that I aim to add to the packet wiki.) However, one annoying race condition has remained throughout the process and I've managed to pinpoint where it's happening but I'm not entirely certain why or how to fix it: Sometimes, when logging into the server my client will stay on the Logging into the server.... Please wait a moment screen. Spirited's Comet source has a useful Login sequence doc which helped me pretty conclusively determine that this is not a problem with the handshake between the AccServer <-> Client <-> Gameserver. It's thanks to the Comet 5017 source and original CopsV6 non enhanced source that I am pretty certain the handshake is working properly. What I think is happening is that the client is sending the MsgConnect packet to the game server before a worker can be properly assigned to handle incoming packets from the client. The reason I believe this is the case is because sometimes, I can login just fine, and can actually break on the MsgConnect packet being received. When the login fails and I am stuck on the black logging into the server screen the worker assigned to handle the connection for the game client does not detect any incoming packets at all. I also found a post Spirited made on another forum that suggested the following: I ruled out that any of the above could be happening because sometimes I am able to login successfully, I assume that if the DH Key exchange is working it will always work correctly or always fail. If anyone has knowledge of this particular source do you have any suggestions on how I could troubleshoot it further? Also, if my understanding of what is happening on the exchange seems incorrect I would also appreciate any corrections made so I don't make the wrong assumptions. One of my primary assumptions here is that the Client, upon receiving the token, game server ip and port from the account server, immediately connects and IMMEDIATELY sends the MsgConnect packet. I truly suspect that the worker assignment is happening too slowly and the MsgConnect packet is getting lost in some cases. Summary, tl;dr: Source: CopsV6 Enhanced Target Patch: 5017 Problem: Race condition where GameServer thread sometimes does not get the MsgConnect packet from the client Requesting: Sanity check on my assumptions about what is happening in the login process. Thanks in advance :) ----------------------------------------------------------------------- Solution: Credits to a friend of mine, Opticalza for spotting this. There appears to be a race condition in the base copsv6 enhanced edition which can result in the client being allowed to BeginReceiving packets before its actually instantiated. The solution proposed by a friend of mine was to move the client.BeginReceive function here and instead add client.BeginReceive(); after onConnect(client) located here This ensures that won't run into an instance where this if statement fails and the client packets are never processed. Hopefully this helps someone else in the future :).
-
Impulse Source 5165 -> Offset calculation issue.
Rezlind replied to Rezlind's topic in Conquer Online
Hmm.... that doesn't look right. Are you sure your packet is decrypted by that point? Side note: I'll make a tutorial at some point for packets, byte endianness, and hex dumps. Hey Spirited, sorry for the delay in responding to you - I actually went looking at the Copsv6 source from your links on this forum. Had a great time messing around and seeing how it handled things - then I came across the copsv6 enhanced source and really liked the upgrades. I was dismayed to see it targeting patch 4330, so I'm in the midst of trying to update the game server to work with Patch 5017. Over-all, I love the general structure of CopsV6Enhanced and found it more enjoyable to pursue upgrading that one than trying to figure out what is going wrong/what I'm doing wrong with Impulse' source. In the end your packet dump class is helping significantly in figuring this out so I thank you for the time you committed already to helping me. -
Impulse Source 5165 -> Offset calculation issue.
Rezlind replied to Rezlind's topic in Conquer Online
I've dumped the contents of the packet below, not quite sure how to utilize this information though. The packet in question 0000: 15 94 56 65 D7 13 C4 A5 DF 0F 33 A5 14 CB 75 6F | ..Ve......3...uo | 0010: 5F 89 B0 22 93 46 F6 E3 D6 00 3E A2 17 C4 78 6C | _..".F....>...xl | 0020: 56 82 BF 2B 92 43 F5 E0 D9 05 35 AB 16 C1 7F 6D | V..+.C....5....m | 0030: 59 87 BA 20 9D 4C F8 E1 D0 0E 30 A0 11 C2 72 62 | Y.. .L....0...rb | 0040: 50 88 B1 29 9C 49 FF E6 DB 03 3F A9 10 CF 71 63 | P..).I....?...qc | 0050: 5B 8D BC 26 9F 4A F2 E7 D2 04 3A A6 13 C8 74 60 | [..&.J....:...t` | 0060: 52 86 BB 2F 9E 47 F1 E4 D5 09 31 AF 12 C5 7B 61 | R../.G....1...{a | 0070: 55 8B B6 24 99 40 F4 E5 DC 02 3C A4 1D C6 7E 66 | U..$.@....<...~f | 0080: 5C 8C BD 2D DE 6F 77 3F 5F 70 1E A8 CC A9 FD B3 | \..-.ow?_p...... | 0090: 68 F7 06 1D 9B 4E FE EB DE 08 36 AA 1F CC 70 64 | h....N....6...pd | 00A0: 5E 8A B7 23 9A 4B FD E8 D1 0D 3D A3 1E C9 77 65 | ^..#.K....=...we | 00B0: 51 8F B2 28 95 44 F0 E9 D8 06 38 A8 19 CA 7A 6A | Q..(.D....8...zj | 00C0: 58 80 B9 21 94 41 F7 EE D3 0B 37 A1 18 C7 79 6B | X..!.A....7...yk | 00D0: 53 85 B4 2E 97 42 FA EF DA 0C 32 AE 1B C0 7C 68 | S....B....2...|h | 00E0: 5A 8E B3 27 96 4F F9 EC DD 01 39 A7 1A CD 73 69 | Z..'.O....9...si | 00F0: 5D 83 BE 2C 91 48 FC ED D4 0A 34 AC 15 CE 76 6E | ]..,.H....4...vn | 0100: 86 56 67 F7 77 D0 D7 17 DB DD E1 77 C6 19 A7 BD | .Vg.w......w.... | 0110: 8D 5B 62 F0 | .[b. | Buffer: 0000: 15 94 56 65 D7 13 C4 A5 DF 0F 33 A5 14 CB 75 6F | ..Ve......3...uo | 0010: 5F 89 B0 22 93 46 F6 E3 D6 00 3E A2 17 C4 78 6C | _..".F....>...xl | 0020: 56 82 BF 2B 92 43 F5 E0 D9 05 35 AB 16 C1 7F 6D | V..+.C....5....m | 0030: 59 87 BA 20 9D 4C F8 E1 D0 0E 30 A0 11 C2 72 62 | Y.. .L....0...rb | 0040: 50 88 B1 29 9C 49 FF E6 DB 03 3F A9 10 CF 71 63 | P..).I....?...qc | 0050: 5B 8D BC 26 9F 4A F2 E7 D2 04 3A A6 13 C8 74 60 | [..&.J....:...t` | 0060: 52 86 BB 2F 9E 47 F1 E4 D5 09 31 AF 12 C5 7B 61 | R../.G....1...{a | 0070: 55 8B B6 24 99 40 F4 E5 DC 02 3C A4 1D C6 7E 66 | U..$.@....<...~f | 0080: 5C 8C BD 2D DE 6F 77 3F 5F 70 1E A8 CC A9 FD B3 | \..-.ow?_p...... | 0090: 68 F7 06 1D 9B 4E FE EB DE 08 36 AA 1F CC 70 64 | h....N....6...pd | 00A0: 5E 8A B7 23 9A 4B FD E8 D1 0D 3D A3 1E C9 77 65 | ^..#.K....=...we | 00B0: 51 8F B2 28 95 44 F0 E9 D8 06 38 A8 19 CA 7A 6A | Q..(.D....8...zj | 00C0: 58 80 B9 21 94 41 F7 EE D3 0B 37 A1 18 C7 79 6B | X..!.A....7...yk | 00D0: 53 85 B4 2E 97 42 FA EF DA 0C 32 AE 1B C0 7C 68 | S....B....2...|h | 00E0: 5A 8E B3 27 96 4F F9 EC DD 01 39 A7 1A CD 73 69 | Z..'.O....9...si | 00F0: 5D 83 BE 2C 91 48 FC ED D4 0A 34 AC 15 CE 76 6E | ]..,.H....4...vn | 0100: 86 56 67 F7 77 D0 D7 17 DB DD E1 77 C6 19 A7 BD | .Vg.w......w.... | 0110: 8D 5B 62 F0 00 00 00 00 00 00 00 00 00 00 00 00 | .[b............. | 0120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ | 0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ................ The rest of the buffer is empty. -
Impulse Source 5165 -> Offset calculation issue.
Rezlind replied to Rezlind's topic in Conquer Online
Sorry about that, I reached out to you specifically because your post on EPvP suggested you had encountered this before. I won't make such direct posts again. I did try debugging, set a couple of breakpoints and couldn't quite determine why the position variable was jumping so wildly at position += (ushort)(JunkLen + 4)); When connecting with the clean 5165 client you provided on these forums, along with ConquerLoader 5.2 (And adjusting my date time temporarily to pre-flash EoL) client sends a 276 length packet when logging in. The Junk Len variable being casted to a short and then added to the position variable seems to skyrocket its value. Admittingly, while I know some decent amount of C#, I don't have much experience with bit conversions and working with packets. I understand why the index out of range issue is occurring, position's value skyrockets after the Junk length ushort is added to it. I guess I'm at a disadvantage not knowing what packet this is and what to expect. I've browsed the helpful packet wiki (https://gitlab.com/conquer-online/wiki/-/wikis/Packets/Packets) but was unable to determine which packet we're working with in this section of the code. Any guidance anyone could provide would be helpful, thank you! -
Hi Spirited, I was experimenting with Impulse's source and encountered an issue that I saw you post about on Epvp (https://www.elitepvpers.com/forum/co2-private-server/1430245-help-impulses-5165-a.html) It appears that Impulse's source has an index out of range issue when trying to calculate the Junk length: try { Client.Exchange = false; Client.Action = 1; ushort position = 7; uint PacketLen = BitConverter.ToUInt32(arg1, position); position += 4; int JunkLen = BitConverter.ToInt32(arg1, position); position += 4; position += (ushort)JunkLen; int Len = BitConverter.ToInt32(arg1, position); position += 4; byte[] pubKey = new byte[Len]; for (int x = 0; x < Len; x++) pubKey[x] = arg1[x + position]; string PubKey = System.Text.ASCIIEncoding.ASCII.GetString(pubKey); Client.Cryptography = Client.DHKeyExchance.HandleClientKeyPacket(PubKey, Client.Cryptography); } I tried using your suggested code: try { Client.Exchange = false; Client.Action = 1; ushort position = 7; uint PacketLen = BitConverter.ToUInt32(arg1, position); int JunkLen = BitConverter.ToInt32(arg1, position += 4); int Len = BitConverter.ToInt32(arg1, position += (ushort)(JunkLen + 4)); byte[] pubKey = new byte[Len]; position += 4; string PubKey = System.Text.ASCIIEncoding.ASCII.GetString(arg1, position, Len); Client.Cryptography = Client.DHKeyExchance.HandleClientKeyPacket(PubKey, Client.Cryptography); } However the issue persists. Is there any guidance you can provide me with not only solving this but understanding why it would be failing here: ```int Len = BitConverter.ToInt32(arg1, position += (ushort)(JunkLen + 4));``` Thank you for your time.
-
Hi Spirited, this is a continuation of my question on Epvp. I was wondering if you had a suggestion on a good roadmap for building out the Comet 5017 source? I.e. if you were looking to fully implement it what packets would you focus on setting up first? Once those are all complete what would you tackle next? Thanks!