patchlwIP - A Lightweight TCP/IP stack - Patches: patch #9533, sys_check_timeouts: recalculate...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #9533: sys_check_timeouts: recalculate the time diff after each handler call

Submitter:  Douglas <ourairquality>
Submitted:  Thu 04 Jan 2018 12:23:02 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  goldsimon Open/Closed:  Closed
Planned Release:  None

Sat 06 Jan 2018 09:25:52 PM UTC, comment #2: 


> Won't do: when checking in every loop, there's a risk we can loop endlessly.


This was not the main bug fixed, see the first paragraph. Without some work here, such as this patch, it seem broken. However if people want to move to using absolute times then that makes this obsolete anyway, and there I agree it seems best to sample sys_now only once.

The code can still get caught in a cycle processing timeouts, but in sys_timeouts_mbox_fetch, it calls sys_timeouts_sleeptime() and keeps looping while this is triggered, so if that is a big concern then perhaps it needs to bail out after a given number of loops to look at the mail box too.

Douglas <ourairquality>
Sat 06 Jan 2018 01:26:35 PM UTC, comment #1: 

Won't do: when checking in every loop, there's a risk we can loop endlessly. When checking once at the beginning of the loop, we ensure other things also get a chance to be executed.

Simon Goldschmidt <goldsimon>
Group administrator
Thu 04 Jan 2018 12:23:02 PM UTC, original submission:  

If there is only one timeout then when the handler is called there will be none. If the handler then calls sys_timeout to install another handler and then sys_timeout will reset the timeouts_last_time. When the handler returns to the sys_check_timeouts loop it was continuing to use a stale diff value and incorrectly checking the times.

This patch modifies sys_check_timeouts to sample sys_now() and timeouts_last_time each time around the loop. This allowed some cleanup of the code.

Also PBUF_CHECK_FREE_OOSEQ() is now called even if there are no timeouts.

Douglas <ourairquality>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by ourairquality (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-01-06 goldsimon StatusNone Wont Do
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2018-01-04 ourairquality Attached File- Added 0001-sys_check_timeouts-recalculate-the-time-diff-after-e.patch, #42822

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code