Skip to content

Commit

Permalink
add arpc.HandleFree()
Browse files Browse the repository at this point in the history
  • Loading branch information
fufuok committed Aug 6, 2024
1 parent b9bb0b6 commit d9ed04b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,11 @@ func HandleMalloc(f func(int) []byte) {
DefaultHandler.HandleMalloc(f)
}

// HandleFree registers buffer releaser.
func HandleFree(f func([]byte)) {
DefaultHandler.HandleFree(f)
}

// EnablePool registers handlers for pool operation for Context and Message and Message.Buffer
func EnablePool(enable bool) {
DefaultHandler.EnablePool(enable)
Expand Down
1 change: 1 addition & 0 deletions handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,6 @@ func TestSetHandler(t *testing.T) {
Handle("nothing", func(*Context) {}, true)
HandleNotFound(func(*Context) {})
HandleMalloc(func(int) []byte { return nil })
HandleFree(func([]byte) {})
SetHandler(d)
}

0 comments on commit d9ed04b

Please sign in to comment.