MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / sleepWithContext

Function sleepWithContext

internal/home/client.go:1081–1097  ·  view source on GitHub ↗
(ctx context.Context, d time.Duration)

Source from the content-addressed store, hash-verified

1079}
1080
1081func sleepWithContext(ctx context.Context, d time.Duration) {
1082 if d <= 0 {
1083 return
1084 }
1085 timer := time.NewTimer(d)
1086 defer timer.Stop()
1087 if ctx == nil {
1088 <-timer.C
1089 return
1090 }
1091 select {
1092 case <-ctx.Done():
1093 return
1094 case <-timer.C:
1095 return
1096 }
1097}

Callers 1

StartConfigSubscriberMethod · 0.85

Calls 1

StopMethod · 0.65

Tested by

no test coverage detected