This commit is contained in:
2026-06-15 01:20:30 +03:00
parent b32279deaf
commit 80309aab99
20 changed files with 149 additions and 40 deletions

View File

@@ -38,13 +38,13 @@ func NewChunkedResponder(dst io.Writer) *ChunkedResponder {
func (s *ChunkedResponder) BufferRecord(rec []byte) {
s.buf.Write(rec)
s.recordsQty++
fmt.Println("BufferRecord", s.recordsQty)
//fmt.Println("BufferRecord", s.recordsQty)
}
func (s *ChunkedResponder) AppendRecord(rec []byte) error {
s.buf.Write(rec)
s.recordsQty++
fmt.Println("AppendRecord", s.recordsQty)
//fmt.Println("AppendRecord", s.recordsQty)
if s.buf.Len() < 1500 {
return nil
@@ -63,7 +63,7 @@ func (s *ChunkedResponder) AppendRecord(rec []byte) error {
}
func (s *ChunkedResponder) Flush() error {
fmt.Println("Flush", s.recordsQty)
//fmt.Println("Flush", s.recordsQty)
if s.recordsQty > 0 {
if err := s.sendBuffered(); err != nil {
return err
@@ -78,14 +78,14 @@ func (s *ChunkedResponder) Flush() error {
}
func (s *ChunkedResponder) sendBuffered() (err error) {
fmt.Println("sendBuffered", s.recordsQty)
//fmt.Println("sendBuffered", s.recordsQty)
msg := s.buf.Bytes()
bin.PutUint32(msg[1:], uint32(s.recordsQty))
fmt.Printf("put uint16: %d\n", msg[:3])
//fmt.Printf("put uint16: %d\n", msg[:3])
fmt.Printf("send %d records\n", s.recordsQty)
//fmt.Printf("send %d records\n", s.recordsQty)
fmt.Printf("send buffered: %d, qty: %d\n", msg, s.recordsQty)
//fmt.Printf("send buffered: %d, qty: %d\n", msg, s.recordsQty)
n, err := s.dst.Write(msg)
if err != nil {