buglwIP - A Lightweight TCP/IP stack - Bugs: bug #36905, SNTP problem with...

 
 

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

bug #36905: SNTP problem with SNTP_STARTUP_DELAY symbol

Submitted by:  Freddie Chopin <freddie_chopin>
Submitted on:  Fri 20 Jul 2012 07:04:15 PM UTC  
 
Category: ContribSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: 1.4.0

Mon 13 Aug 2012 07:44:04 PM UTC, comment #1:

Fixed by adding a new optional macro SNTP_STARTUP_DELAY_FUNC.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 20 Jul 2012 07:04:15 PM UTC, original submission:

This is about file sntp.c

When I try to define SNTP_STARTUP_DELAY symbol as any function (let that be rand()) it gives me compiler error:

lwIP/lwIP_Apps/apps/sntp/sntp.c: In function 'sntp_init':
lwIP/lwIP_Apps/apps/sntp/sntp.c:696:5: error: missing binary operator before token "("

on line:

#if SNTP_STARTUP_DELAY

The solution I've found is to define the symbol as a numeric non-zero value (for the "#if") and add another symbol SNTP_STARTUP_DELAY_FUNC used in this line:

sys_timeout((u32_t)SNTP_STARTUP_DELAY_FUNC, sntp_request, NULL);

This way I have two defines:

#ifndef SNTP_STARTUP_DELAY
#define SNTP_STARTUP_DELAY rand
#define SNTP_STARTUP_DELAY_FUNC ((rand() % (4 * 60 * 1000)) + (60 * 1000))
#endif

I don't know whether it's possible to use current code and define original symbol to be some function - probably not.

Freddie Chopin <freddie_chopin>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 13 Aug 2012 07:44:04 PM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1