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
poll()/select() from another thread.
It introduces subtle bugs.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4742 77e5149b-7576-45b1-b177-96237e5ba77b
Also introduce MaxQueue, this will prevent clamdscan from flooding
clamd with too many FILDES requests.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4710 77e5149b-7576-45b1-b177-96237e5ba77b
Though when poll says that socket is closed, we shouldn't try closing again
if we're in WAIT_REPLY mode (since we alraedy closed it from another thread).
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4698 77e5149b-7576-45b1-b177-96237e5ba77b
MULTISCAN now quits if client quits
(TODO: CONTSCAN/SCAN should have a group too!)
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4685 77e5149b-7576-45b1-b177-96237e5ba77b
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
Show a verbose message that we are waiting for threads to quit.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4649 77e5149b-7576-45b1-b177-96237e5ba77b