From 19466ba249e6589ddf967a1ec3688bc3e7828daa Mon Sep 17 00:00:00 2001 From: c1982 Date: Fri, 10 Apr 2015 22:01:56 +0300 Subject: [PATCH 1/5] Added TCP_TIMEOUT Default tcp timeout 3minutes. change to optional in newCLAMDTcpConn function. --- conn.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/conn.go b/conn.go index df83253..d2a7464 100644 --- a/conn.go +++ b/conn.go @@ -35,6 +35,7 @@ import ( ) const CHUNK_SIZE = 1024 +const TCP_TIMEOUT = time.Second * 2 type CLAMDConn struct { net.Conn @@ -111,8 +112,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 } From 11ba4f047f100cfc20261ca5376f91ffa5ec5436 Mon Sep 17 00:00:00 2001 From: c1982 Date: Sat, 11 Apr 2015 00:36:34 +0300 Subject: [PATCH 2/5] added time import --- conn.go | 1 + 1 file changed, 1 insertion(+) diff --git a/conn.go b/conn.go index d2a7464..32da3a8 100644 --- a/conn.go +++ b/conn.go @@ -32,6 +32,7 @@ import ( "net" "strings" "sync" + "time" ) const CHUNK_SIZE = 1024 From 984f179a6338b2ee3e44e2ba98d99af4c6886b53 Mon Sep 17 00:00:00 2001 From: c1982 Date: Sat, 11 Apr 2015 00:36:41 +0300 Subject: [PATCH 3/5] Revert "added time import" This reverts commit 11ba4f047f100cfc20261ca5376f91ffa5ec5436. --- conn.go | 1 - 1 file changed, 1 deletion(-) diff --git a/conn.go b/conn.go index 32da3a8..d2a7464 100644 --- a/conn.go +++ b/conn.go @@ -32,7 +32,6 @@ import ( "net" "strings" "sync" - "time" ) const CHUNK_SIZE = 1024 From c0465a22f6214ed57400f7d7a9f65470629ef1bb Mon Sep 17 00:00:00 2001 From: c1982 Date: Sat, 11 Apr 2015 00:36:46 +0300 Subject: [PATCH 4/5] Revert "Revert "added time import"" This reverts commit 984f179a6338b2ee3e44e2ba98d99af4c6886b53. --- conn.go | 1 + 1 file changed, 1 insertion(+) diff --git a/conn.go b/conn.go index d2a7464..32da3a8 100644 --- a/conn.go +++ b/conn.go @@ -32,6 +32,7 @@ import ( "net" "strings" "sync" + "time" ) const CHUNK_SIZE = 1024 From f1c6fb7bfc46eaced66e5e903348c3b2065233d7 Mon Sep 17 00:00:00 2001 From: justbumpbot Date: Tue, 28 Apr 2020 22:56:35 +0000 Subject: [PATCH 5/5] chore: create version file 0.0.0 --- VERSION | 1 + 1 file changed, 1 insertion(+) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..bd52db8 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.0.0 \ No newline at end of file