Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.0
9 changes: 8 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ import (
"net"
"strings"
"sync"
"time"
)

const CHUNK_SIZE = 1024
const TCP_TIMEOUT = time.Second * 2

type CLAMDConn struct {
net.Conn
Expand Down Expand Up @@ -111,8 +113,13 @@ func (c *CLAMDConn) readResponse() (chan string, sync.WaitGroup, error) {
}

func newCLAMDTcpConn(address string) (*CLAMDConn, error) {
conn, err := net.Dial("tcp", address)
conn, err := net.DialTimeout("tcp", address, TCP_TIMEOUT)

if err != nil {
if nerr, isOk := err.(net.Error); isOk && nerr.Timeout() {
return nil, nerr
}

return nil, err
}

Expand Down