diff options
Diffstat (limited to 'internal/client/gateway')
| -rw-r--r-- | internal/client/gateway/gateway.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/client/gateway/gateway.go b/internal/client/gateway/gateway.go index 441395a..22d851f 100644 --- a/internal/client/gateway/gateway.go +++ b/internal/client/gateway/gateway.go @@ -53,8 +53,10 @@ func init() { } } -func Connect(ctx context.Context, privKey ed25519.PrivateKey) tea.Cmd { +func Connect(privKey ed25519.PrivateKey, timeout time.Duration) tea.Cmd { return func() tea.Msg { + ctx, cancel := context.WithTimeout(context.Background(), timeout) + defer cancel() err := connect(ctx, privKey) if err != nil { return ConnectionFailed(err) |
