From 5582d8370cce68bbad1f7e44f1fdc52fdc9d9d71 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 22 Aug 2022 14:00:04 +0200 Subject: [PATCH] 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 --- ctlsock/ctlsock.go | 8 ++++++-- 1 file 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