forked from quic-go/quic-go
http3: use the stream context to detect when the send side is closed (#4489)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package http3
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
|
||||
@@ -26,6 +27,9 @@ type stateTrackingStream struct {
|
||||
}
|
||||
|
||||
func newStateTrackingStream(s quic.Stream, onStateChange func(streamState, error)) *stateTrackingStream {
|
||||
context.AfterFunc(s.Context(), func() {
|
||||
onStateChange(streamStateSendClosed, context.Cause(s.Context()))
|
||||
})
|
||||
return &stateTrackingStream{
|
||||
Stream: s,
|
||||
state: streamStateOpen,
|
||||
|
||||
Reference in New Issue
Block a user