1

I'm using kryonet for my LibGDX project. Every time a client connects to the server, a new connection ID gets created. Eg. Client 1: ID 1. Client 2: ID 2.

When a client reconnects, the counter continues, it does not seem to reuse older IDs. Eg. Client 1 reconnects: ID 3.

Does kryonet reset the counter after a while? Or is there any way to reset the counter? I'm worried about running into issues after my server has been running for a little while.

kwantuM
  • 512
  • 6
  • 20
  • How long a little while are we talking? Assuming a 32-bit connection ID, and 100 requests / s, you're looking at over a year of uptime before any kind of problem! – Eric Aug 20 '16 at 07:42

1 Answers1

0

I have solved my own problem but I will leave it here if anyone is interested.

I was looking through the source of Kryonet and found this:

int id = nextConnectionID++;
if (nextConnectionID == -1) nextConnectionID = 1;

When this value reaches the maximum value, it flips to the minimum value. Ref: https://stackoverflow.com/a/5131206/4697327 .

I guess there will never be a problem.

EDIT: Kryonet uses -1 as ID when the Connection has never been made. If the nextConnectionID counts up to 32 bits max value, then flips to it's minimum value and counts up to 0 again, it will pass -1 at some point. This will be a problem for one connection. I haven't found a problem with negative ID's yet.

Community
  • 1
  • 1
kwantuM
  • 512
  • 6
  • 20
  • I posted this as an issue at Kryonets github : https://github.com/EsotericSoftware/kryonet/issues/119 – kwantuM Aug 20 '16 at 08:45