Page 1 of 1

BUG: minisapserver sap_delay is broken

Posted: 15 May 2006 03:56
by geo
minisapserver 0.3.2

It looks like the sap_delay parameter doesn't work. Even with large and small values, the rate of SAP packets seen is many per second, not every 30 secs.

thanks - George




[global]

# TTL (Time To Live) of the SAP announces. You should put 255
sap_ttl=255

# Number of seconds between announces. 5 is default. Internet announces better use 30.
sap_delay=30

[program]
name=NOW (Hong Kong)
address=233.70.142.178
port=1234
playlist_group=UCTV
user=University_of_Canberra
machine=tv.canberra.edu.au
site=http://uctv.canberra.edu.au
program_ttl=32

[program]
name=NHK Japan (Japan)
address=233.70.142.179
port=1234
playlist_group=UCTV
user=University_of_Canberra
machine=tv.canberra.edu.au
site=http://uctv.canberra.edu.au
program_ttl=32

[program]
name=Voice of America (United States)
address=233.70.142.205
port=1234
playlist_group=UCTV
user=University_of_Canberra
machine=tv.canberra.edu.au
site=http://uctv.canberra.edu.au
program_ttl=32

Posted: 05 Jun 2006 09:21
by geo
When compiling minisapserver 0.3.2, it looks like it does not find the value for config.Programs.size()

I get

Code: Select all

sapserver.cpp: In function 'int main(int, char**)': sapserver.cpp:196: warning: format '%u' expects type 'unsigned int', but argument 2 has type 'size_t'
Line 196 is:

Code: Select all

/* TODO check configuration */ printf("+ %u programs loaded\n",config.Programs.size());
The delay routine in line 251 needs the size():

Code: Select all

{ delay.tv_sec = 0; delay.tv_nsec = 1000000000 * config.GetDelay() / config.Programs.size(); }
and is not delaying at all without this value.

I'm no expert here, and don't know how to fix this so the config-file delay parameter can be used as expected.

A workaround is to change the delay.tv_sec value to the number of seconds delay you need.

Code: Select all

{ delay.tv_sec = 30; delay.tv_nsec = 1000000000 * config.GetDelay() / config.Programs.size(); }
Only on Mac OS X do I get the compile time error, not linux. However both versions act the same, in that any sap_delay other than 5 will not delay at all, producing a broadcast storm of SAP packets.