Re: clamd: Keep scanning while reloading database

Julius Plenz <[email protected]>
Newsgroups gmane.comp.security.virus.clamav.devel
Message-ID <[email protected]>
Hi, Mark!

* Mark Pizzolato - ClamAV-devel <[email protected]> [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
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.