MCPcopy Create free account
hub / github.com/cloudwego/netpoll / SetOnRequest

Method SetOnRequest

connection_onevent.go:66–76  ·  view source on GitHub ↗

SetOnRequest initialize ctx when setting OnRequest.

(onRequest OnRequest)

Source from the content-addressed store, hash-verified

64
65// SetOnRequest initialize ctx when setting OnRequest.
66func (c *connection) SetOnRequest(onRequest OnRequest) error {
67 if onRequest == nil {
68 return nil
69 }
70 c.onRequestCallback.Store(onRequest)
71 // fix: trigger OnRequest if there is already input data.
72 if !c.inputBuffer.IsEmpty() {
73 c.onRequest()
74 }
75 return nil
76}
77
78// AddCloseCallback adds a CloseCallback to this connection.
79func (c *connection) AddCloseCallback(callback CloseCallback) error {

Callers 1

onPrepareMethod · 0.95

Calls 2

onRequestMethod · 0.95
IsEmptyMethod · 0.45

Tested by

no test coverage detected