jcmcbeth / Planets

2 stars 1 forks source link

Handle overflow of descriptor_data.idle #4

Open jcmcbeth opened 3 years ago

jcmcbeth commented 3 years ago

Now that immortals can be idle indefinitely, we need to handle overflow.

descriptor_data.idle is a short int, assuming the comments are correct and 28800 is 2 hours then an immortal can only idle for 65535/28800 ~= 2.27. Which means they can only idle for about 4.5 hours before it overflows. That's probably signed, so it's probably overflows a little over 2 hours.

I was hoping this was an int so this would be more of a formality, but given that it's not it needs to be handled.

So now these are the options I see:

I would say change the size to int and have it idle timeout when reaching max int, we just have to make sure that nothing depends on the size of that property.

jcmcbeth commented 3 years ago

The branch for this seems to crash with bad descriptor a few minutes after connecting after increasing the size of the idle property to unsigned int. I have to figure out why that is happening. GDB just says exited with code 02.