kylefarris/clamscan

Tear connection when timing out

srilumpa opened this issue · 0 comments

Hi,

If a timeout occurs when scanning a file in clamdscan mode, the client still waits for the scan to end. It is because in the the client.end() method is called when handling the timeout event on https://github.com/kylefarris/clamscan/blob/master/index.js#L467 instead of calling client.destroy().

I understand the need to still keep waiting for the scan result even if it took too much time, but would it be possible to implement some "hard timeout" option that effectively destroys the socket and throws an error? It would be useful for case when the ClamAV service is saturated and we would postpone the scan, for example.