From 3f9bd8f121b07e30227dac7005e9072ba1a1bdc5 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 28 Mar 2026 20:03:38 +0000 Subject: network: Rename flush (clearly distinguish flushing IO and writing flush packets) --- network/protocol/pktline/encoder.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'network/protocol/pktline/encoder.go') diff --git a/network/protocol/pktline/encoder.go b/network/protocol/pktline/encoder.go index 3d92ca19..4c7dcd6e 100644 --- a/network/protocol/pktline/encoder.go +++ b/network/protocol/pktline/encoder.go @@ -87,36 +87,36 @@ func (e *Encoder) WriteString(s string) (int, error) { return len(s), nil } -// WriteFlush writes control frame 0000 (flush-pkt). -func (e *Encoder) WriteFlush() error { +// WriteFlushPacket writes control frame 0000 (flush-pkt). +func (e *Encoder) WriteFlushPacket() error { return e.writeControl(0) } -// WriteDelim writes control frame 0001 (delim-pkt). -func (e *Encoder) WriteDelim() error { +// WriteDelimPacket writes control frame 0001 (delim-pkt). +func (e *Encoder) WriteDelimPacket() error { return e.writeControl(1) } -// WriteResponseEnd writes control frame 0002 (response-end-pkt). -func (e *Encoder) WriteResponseEnd() error { +// WriteResponseEndPacket writes control frame 0002 (response-end-pkt). +func (e *Encoder) WriteResponseEndPacket() error { return e.writeControl(2) } -// FlushIO flushes buffered output in the underlying transport. +// Flush flushes buffered output in the underlying transport. // -// FlushIO does not emit any pkt-line control frame. -func (e *Encoder) FlushIO() error { +// Flush does not emit any pkt-line control frame. +func (e *Encoder) Flush() error { return e.w.Flush() } -// WriteFlushAndFlushIO writes a flush-pkt (0000) then flushes transport I/O. -func (e *Encoder) WriteFlushAndFlushIO() error { - err := e.WriteFlush() +// WriteFlushPacketAndFlush writes a flush-pkt (0000) then flushes transport I/O. +func (e *Encoder) WriteFlushPacketAndFlush() error { + err := e.WriteFlushPacket() if err != nil { return err } - return e.FlushIO() + return e.Flush() } func (e *Encoder) writeControl(n int) error { -- cgit v1.3.1-10-gc9f91