Skip to content

Commit

Permalink
fix: reuse op
Browse files Browse the repository at this point in the history
  • Loading branch information
joway committed Aug 2, 2023
1 parent 12cd849 commit bd58bbd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions net_polldesc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ import (
"context"
)

// TODO: recycle *pollDesc
func newPollDesc(fd int) *pollDesc {
pd := &pollDesc{}
pd.operator = &FDOperator{
poll: pollmanager.Pick(),
FD: fd,
OnWrite: pd.onwrite,
OnHup: pd.onhup,
}
poll := pollmanager.Pick()

pd.operator = poll.Alloc()
pd.operator.FD = fd
pd.operator.OnWrite = pd.onwrite
pd.operator.OnHup = pd.onhup
pd.writeTrigger = make(chan struct{})
pd.closeTrigger = make(chan struct{})
return pd
Expand Down

0 comments on commit bd58bbd

Please sign in to comment.