summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2022-08-22 14:00:04 +0200
committerJakob Unterwurzacher2022-08-22 14:00:36 +0200
commit5582d8370cce68bbad1f7e44f1fdc52fdc9d9d71 (patch)
tree41e4fe8c4eab3a3b965e8a4d0f7199b770045b26
parent702a2e19ccaba962449f3844d57f32e56711422e (diff)
ctlsock: raise timeout to 10 seconds
There was at least one user who hit the earlier 1 second timeout. Raise to 10 seconds which ought to be enough for anyone. Fixes https://github.com/rfjakob/gocryptfs/issues/683
-rw-r--r--ctlsock/ctlsock.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/ctlsock/ctlsock.go b/ctlsock/ctlsock.go
index 1c440b5..47df9d0 100644
--- a/ctlsock/ctlsock.go
+++ b/ctlsock/ctlsock.go
@@ -21,9 +21,13 @@ type CtlSock struct {
Conn net.Conn
}
+// There was at least one user who hit the earlier 1 second timeout. Raise to 10
+// seconds which ought to be enough for anyone.
+const ctlsockTimeout = 10 * time.Second
+
// New opens the socket at `socketPath` and stores it in a `CtlSock` object.
func New(socketPath string) (*CtlSock, error) {
- conn, err := net.DialTimeout("unix", socketPath, 1*time.Second)
+ conn, err := net.DialTimeout("unix", socketPath, ctlsockTimeout)
if err != nil {
return nil, err
}
@@ -32,7 +36,7 @@ func New(socketPath string) (*CtlSock, error) {
// Query sends a request to the control socket returns the response.
func (c *CtlSock) Query(req *RequestStruct) (*ResponseStruct, error) {
- c.Conn.SetDeadline(time.Now().Add(time.Second))
+ c.Conn.SetDeadline(time.Now().Add(ctlsockTimeout))
msg, err := json.Marshal(req)
if err != nil {
return nil, err