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

Method AddCloseCallback

connection_onevent.go:79–90  ·  view source on GitHub ↗

AddCloseCallback adds a CloseCallback to this connection.

(callback CloseCallback)

Source from the content-addressed store, hash-verified

77
78// AddCloseCallback adds a CloseCallback to this connection.
79func (c *connection) AddCloseCallback(callback CloseCallback) error {
80 if callback == nil {
81 return nil
82 }
83 cb := &callbackNode{}
84 cb.fn = callback
85 if pre := c.closeCallbacks.Load(); pre != nil {
86 cb.pre = pre.(*callbackNode)
87 }
88 c.closeCallbacks.Store(cb)
89 return nil
90}
91
92// onPrepare supports close connection, but not read/write data.
93// connection will be registered by this call after preparing.

Callers 1

initFinalizerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected