Skip to content

Commit 6ce7b12

Browse files
authored
fix: shorter waiting for ping (#137)
1 parent 99f76e4 commit 6ce7b12

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cmd/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ func rootCmd() *cmdBuilder.Cmd {
8484
}
8585
}
8686

87-
ctx, cancel := context.WithTimeout(ctx, time.Second*5)
87+
pingCtx, cancel := context.WithTimeout(ctx, time.Second)
8888
defer cancel()
8989

90-
if err := nettools.Ping(ctx, vpnCheckAddress); err != nil {
90+
if err := nettools.Ping(pingCtx, vpnCheckAddress); err != nil {
9191
body.AddStringsRow(i18n.T(i18n.StatusInfoVpnStatus), i18n.T(i18n.VpnCheckingConnectionIsNotActive))
9292
} else {
9393
body.AddStringsRow(i18n.T(i18n.StatusInfoVpnStatus), i18n.T(i18n.VpnCheckingConnectionIsActive))

src/cmd/vpnUp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ func isVpnConnect(ctx context.Context, uxBlocks uxBlock.UxBlocks) bool {
184184
p := []uxHelpers.Process{
185185
{
186186
F: func(ctx context.Context) error {
187-
ctx, cancel := context.WithTimeout(ctx, time.Second*5)
187+
pingCtx, cancel := context.WithTimeout(ctx, time.Second)
188188
defer cancel()
189189

190-
return nettools.Ping(ctx, vpnCheckAddress)
190+
return nettools.Ping(pingCtx, vpnCheckAddress)
191191
},
192192
RunningMessage: i18n.T(i18n.VpnCheckingConnection),
193193
ErrorMessageMessage: i18n.T(i18n.VpnCheckingConnectionIsNotActive),

0 commit comments

Comments
 (0)