MCPcopy
hub / github.com/nats-io/nats.go / flush

Method flush

nats.go:2206–2219  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2204}
2205
2206func (w *natsWriter) flush() error {
2207 // If a pending buffer is set, we don't flush. Code that needs to
2208 // write directly to the socket, by-passing buffers during (re)connect,
2209 // will use the writeDirect() API.
2210 if w.pending != nil {
2211 return nil
2212 }
2213 // Do not skip calling w.w.Write() here if len(w.bufs) is 0 because
2214 // the actual writer (if websocket for instance) may have things
2215 // to do such as sending control frames, etc..
2216 _, err := w.w.Write(w.bufs)
2217 w.bufs = w.bufs[:0]
2218 return err
2219}
2220
2221func (w *natsWriter) buffered() int {
2222 if w.pending != nil {

Callers 7

appendBufsMethod · 0.95
wsEnqueueControlMsgMethod · 0.80
ForceReconnectMethod · 0.80
flusherMethod · 0.80
sendPingMethod · 0.80
closeMethod · 0.80

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected