Skip to content

Commit

Permalink
optimise: rm useless inputBarrier (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
joway authored Oct 18, 2023
1 parent 833a795 commit 4c41390
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
3 changes: 1 addition & 2 deletions connection_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ type connection struct {
writeTrigger chan error
inputBuffer *LinkBuffer
outputBuffer *LinkBuffer
inputBarrier *barrier
outputBarrier *barrier
supportZeroCopy bool
maxSize int // The maximum size of data between two Release().
Expand Down Expand Up @@ -323,7 +322,7 @@ func (c *connection) init(conn Conn, opts *options) (err error) {
c.writeTrigger = make(chan error, 1)
c.bookSize, c.maxSize = pagesize, pagesize
c.inputBuffer, c.outputBuffer = NewLinkBuffer(pagesize), NewLinkBuffer()
c.inputBarrier, c.outputBarrier = barrierPool.Get().(*barrier), barrierPool.Get().(*barrier)
c.outputBarrier = barrierPool.Get().(*barrier)

c.initNetFD(conn) // conn must be *netFD{}
c.initFDOperator()
Expand Down
1 change: 0 additions & 1 deletion connection_reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (c *connection) closeBuffer() {
// so we need to check the buffer length, and if it's an "unclean" close operation, let's give up to reuse the buffer
if c.inputBuffer.Len() == 0 || onConnect != nil || onRequest != nil {
c.inputBuffer.Close()
barrierPool.Put(c.inputBarrier)
}
if c.outputBuffer.Len() == 0 || onConnect != nil || onRequest != nil {
c.outputBuffer.Close()
Expand Down

0 comments on commit 4c41390

Please sign in to comment.