Skip to content

Commit

Permalink
fix: dont reset tail read node
Browse files Browse the repository at this point in the history
  • Loading branch information
joway committed Jul 23, 2024
1 parent eeceef6 commit 2bf73f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 7 additions & 0 deletions connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ func TestConnectionRead(t *testing.T) {
}

func TestConnectionNoCopyReadString(t *testing.T) {
err := Configure(Config{Feature: Feature{AlwaysNoCopyRead: true}})
MustNil(t, err)
defer func() {
err = Configure(Config{Feature: Feature{AlwaysNoCopyRead: false}})
MustNil(t, err)
}()

r, w := GetSysFdPairs()
var rconn, wconn = &connection{}, &connection{}
rconn.init(&netFD{fd: r}, nil)
Expand Down
3 changes: 0 additions & 3 deletions netpoll_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build !windows
// +build !windows

package netpoll

import (
Expand Down
3 changes: 1 addition & 2 deletions nocopy_linkbuffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,8 @@ func (b *UnsafeLinkBuffer) calcMaxSize() (sum int) {
// resetTail will reset tail node or add an empty tail node to
// guarantee the tail node is not larger than 8KB
func (b *UnsafeLinkBuffer) resetTail(maxSize int) {
// FIXME: Reset should be removed when find a decent way to reuse buffer
if maxSize <= pagesize {
b.write.Reset()
// no need to reset a small buffer tail node
return
}
// set nil tail
Expand Down

0 comments on commit 2bf73f2

Please sign in to comment.