[Clamav-devel] clamd: Keep scanning while reloading database

Julius Plenz plenz at cis.fu-berlin.de
Mon Apr 7 16:49:49 EDT 2014


Hi, Mark!

* Mark Pizzolato - ClamAV-devel <clamav-devel at subscriptions.pizzolato.net> [2014-04-07 21:17]:
> I haven't looked closely, but how is the fact that each thread
> (which may currently be scanning a different file and may finish at
> some arbitrary time in the future) has a reference to the current
> engine object handled?

It appears that for every connection that is acceptey by clamd, the
current "engine" value is passed in the "conn" struct. The engine
struct has a ref count, and a process "grabs" the engine by calling
cl_engine_addref(), thus increasing the ref count. Only when
cl_engine_free() is called and the ref count is zero is the object
actually freed.

This is what I got from a cursory reading of the code... (such a
request/command is passed around quite a lot.) I verified that the old
engine was indeed freed after the scan finished by plucking in debug
statements in the relevant functions.

Julius



More information about the clamav-devel mailing list