Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
lesismal committed Feb 13, 2024
1 parent 5e99e20 commit 50b8c1f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ func (c *Conn) IsUnix() bool {

// OnData registers callback for data.
func (c *Conn) OnData(h func(conn *Conn, data []byte)) {
c.DataHandler = h
c.dataHandler = h
}

// DataHandler returns data handler.
func (c *Conn) DataHandler() func(conn *Conn, data []byte) {
return c.dataHandler
}

// Dial wraps net.Dial.
Expand Down
2 changes: 1 addition & 1 deletion conn_std.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Conn struct {

cache *bytes.Buffer

DataHandler func(c *Conn, data []byte)
dataHandler func(c *Conn, data []byte)
}

// Hash returns a hashcode.
Expand Down
2 changes: 1 addition & 1 deletion conn_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type Conn struct {

readEvents int32

DataHandler func(c *Conn, data []byte)
dataHandler func(c *Conn, data []byte)
}

// Hash returns a hash code.
Expand Down
2 changes: 1 addition & 1 deletion nbhttp/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ func NewEngine(conf Config) *Engine {
})

g.OnData(func(c *nbio.Conn, data []byte) {
c.DataHandler(c, data)
c.DataHandler()(c, data)
})

// engine.isOneshot = (conf.EpollMod == nbio.EPOLLET && conf.EPOLLONESHOT == nbio.EPOLLONESHOT && runtime.GOOS == "linux")
Expand Down

0 comments on commit 50b8c1f

Please sign in to comment.