do not rely on unspecified Go behaviour; fix TCP ring buffer bug (#16)

* do not rely on unspecified Go behaviour; fix TCP ring buffer bug

* even more stricter error handling on tcp connections

* stricter lock copying in tcp.Conn, even though likely not a problem

* add listener and tcp pool logging

* forgot reqAddr unused

* add logging to TCPConn and friends
This commit is contained in:
Pat Whittingslow
2026-01-05 10:03:24 -03:00
committed by GitHub
parent 018f9258ac
commit 7698b9fb81
14 changed files with 570 additions and 112 deletions
+4 -2
View File
@@ -131,7 +131,7 @@ func (r *Ring) ReadPeek(b []byte) (int, error) {
// Read reads up to len(b) bytes from the ring buffer and advances the read pointer. [io.EOF] returned when no data available.
func (r *Ring) Read(b []byte) (int, error) {
n, err := r.read(b)
if err != nil {
if err != nil || len(b) == 0 {
return n, err
}
r.onReadEnd(n)
@@ -139,7 +139,9 @@ func (r *Ring) Read(b []byte) (int, error) {
}
func (r *Ring) read(b []byte) (n int, err error) {
if r.IsEmpty() {
if len(b) == 0 {
return 0, nil
} else if r.IsEmpty() {
return 0, io.EOF
}
if r.End > r.Off {