Each multiscan command needs 1 control thread, and 1 (possibly shared) scanner
thread.
If the number of multiscan control threads would be equal to MaxThreads no
progress could be made, since each one would be waiting for 1 free scanner
thread (but none can be spawned since maxthreads was already reached).
As long as there is 1 thread free for scanning, we can have N-1 multiscan
commands active, with N MaxThreads.
it can return a pointer to a static location, as described in the manpage.
This can happen on a Linux system with a foreign locale, where the LANG=C messages are
returned this way. (BB #1403)
git-svn: trunk@4827
This means that IDSESSION/INSTREAM must be sent as nIDSESSION\n or zIDSESSION\0,
ditto for INSTREAM.
Adjust testcases accordingly.
Old commands are still accepted when sent without delimiter.
git-svn: trunk@4811
since a buggy client implementation may get stuck in send(), and then clamd
gets stuck in send() -> deadlock. To avoid this we need nonblocking sockets, and
(low) timeouts on send.
Add more tests for clamd protocol, including a stress test for IDSESSION.
git-svn: trunk@4798
Make handling of old-style commands compatible with old clamd: if they have a \n
that will delimit the command.
If multiscan of a single file encounters errors, don't reply OK too.
git-svn: trunk@4796
handle multiple %v parameters
introduce poll_fds that also does the read into a buffer
introduce thrmgr_group* commands for keeping track of groups of commands
(multiscan, IDSESSION)
introduce 2 queues in thrmgr, multiscan queues get lower priority. Commands
are processed from both queues in a 4:1 ratio to avoid starvation.
unify reply code: conn_reply*
unify scanner code into scan_callback that is called from cli_ftw
multiscan doesn't need stat() now if readdir() provides dt_type
redesign clamd main loop: there is now an accept thread, and a
recv()/dispatch thread, +MaxThreads worker (scanner) threads.
introduce limiting on commands when worker threads are contended.
introduce IDSESSION, a replacement for the old SESSION command, that allows
asyncronous (scan) commands and scan replies
introduce INSTREAM that allows sending the data to scan on same connection
(vs STREAM that requires another port)
introduce zCOMMANDS
git-svn: trunk@4755
TODO: the code starts to look ugly, clean up the code.
INSTREAM shouldn't reply fd[]
make jobgroup own the resources (sockets, tempfiles)
allow to notify jobgroup to terminate when remote disconnects
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4681 77e5149b-7576-45b1-b177-96237e5ba77b