OK... so I'm only partially an idiot (not a complete one)...

Do you want to try moving the routine up into scanIdleLoop?  Then it would
respect the intervals...

Patch attached...

1st minute (scan & purge)

May  2 17:02:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=0,
sessions=3)
May  2 17:02:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:02:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=0]
May  2 17:02:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=1,
sessions=0)
May  2 17:02:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:02:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=1]
May  2 17:02:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=2,
sessions=0)
May  2 17:02:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:02:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=2]
May  2 17:02:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=3,
sessions=0)
May  2 17:02:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:02:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=3]

2nd minute (scan only)

May  2 17:03:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=0,
sessions=3)
May  2 17:03:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:03:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=1,
sessions=0)
May  2 17:03:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:03:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=2,
sessions=0)
May  2 17:03:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:03:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=3,
sessions=0)
May  2 17:03:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions

5th minute (scan and purge again):

May  2 17:07:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=0,
sessions=4)
May  2 17:07:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:07:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=0]
May  2 17:07:17 tigger ntop[4206]: Purging host (idx=0/192.168.42.51) (0 hosts
purged)
May  2 17:07:17 tigger ntop[4206]: Purging completed in 0 sec [1 hosts deleted]
May  2 17:07:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=1,
sessions=0)
May  2 17:07:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:07:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=1]
May  2 17:07:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=2,
sessions=0)
May  2 17:07:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:07:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=2]
May  2 17:07:17 tigger ntop[4206]: Called scanTimedoutTCPSessions (device=3,
sessions=0)
May  2 17:07:17 tigger ntop[4206]: scanTimedoutTCPSessions: freed 0 sessions
May  2 17:07:17 tigger ntop[4206]: Purging Idle Hosts... [actDevice=3]

Looks ok to me... Let me know if it works for you and I'll send it on to Luca...

-----Burton


-----Original Message-----
From: Christian Hammers [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 02, 2002 4:47 PM
To: Burton M. Strauss III
Cc: Ntop
Subject: Re: [Ntop-dev] PURGE_HOSTS_DELAY vs. SESSION_SCAN_DELAY


On Thu, May 02, 2002 at 04:42:35PM -0500, Burton M. Strauss III wrote:
> purgeIdleHosts() in hash.c IS getting invoked.
of course...

> So, if the elapsed time isn't at least 300s
>
>   if(startTime < (lastPurgeTime[actDevice]+PURGE_HOSTS_DELAY))
>     return; /* Too short */
>
> returns.  But once every 5m it will continue and do the purge...
>
>   scanTimedoutTCPSessions(actDevice); /* let's check timedout sessions too */
>
> Are you saying the TCPSessions scan should be moved up and use the
> SESSION_SCAN_DELAY interval???  Moved into ntop.c around 611:

Yes, regardless, where the function is actually called, it should either
use the SESSION_SCAN_DELAY variable or the other relevant variable
(PURGE_HOST_DELAY) should become a comment that describes that it, too,
controls the session scan and not only the host scan..

:)
-christian-


--
Christian Hammers    WESTEND GmbH - Aachen und Dueren     Tel 0241/701333-0
[EMAIL PROTECTED]     Internet & Security for Professionals    Fax 0241/911879
          WESTEND ist CISCO Systems Partner - Authorized Reseller

Attachment: BMS0067-sessionpurgedelay.patch
Description: Binary data

Reply via email to