Skip to content

Commit

Permalink
psiphon: fix bug with early proxy shutdown
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Pashmfouroush <[email protected]>
  • Loading branch information
markpash committed Mar 15, 2024
1 parent db5b413 commit 4ab1358
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions psiphon/p.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,16 @@ func RunPsiphon(ctx context.Context, l *slog.Logger, wgBind, localSocksPort, cou

l.Info("Handshaking, Please Wait...")

ctx, _ = context.WithTimeout(ctx, 2*time.Minute)
childCtx, cancel := context.WithTimeout(ctx, 2*time.Minute)
defer cancel()
t0 := time.Now()
t := time.NewTicker(1 * time.Second)
defer t.Stop()

for {
select {
case <-ctx.Done():
if errors.Is(ctx.Err(), context.Canceled) {
case <-childCtx.Done():
if errors.Is(childCtx.Err(), context.Canceled) {
return errors.New("psiphon handshake operation canceled")
}
return errors.New("psiphon handshake maximum time exceeded")
Expand Down

0 comments on commit 4ab1358

Please sign in to comment.