Skip to content

Commit bc9e56a

Browse files
committed
Add a clarifying comment to bgctx.
I wasn't sure about this, and had to read NewConn carefully to confirm it. A bunch of code implicitly relies on this, let's make it explicit.
1 parent 70a38c2 commit bc9e56a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rpc/rpc.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ type Conn struct {
7272
er errReporter
7373
abortTimeout time.Duration
7474

75-
// bgctx is a Context that is canceled when shutdown starts.
75+
// bgctx is a Context that is canceled when shutdown starts. Note
76+
// that it's parent is context.Background(), so we can rely on this
77+
// being the *only* time it will be canceled.
7678
bgctx context.Context
79+
7780
// tasks block shutdown.
7881
tasks sync.WaitGroup
7982
closed chan struct{} // closed when shutdown() returns

0 commit comments

Comments
 (0)