1
0
Fork 0
mirror of https://github.com/sourcegraph/jsonrpc2.git synced 2026-06-17 12:40:03 +02:00
jsonrpc2/async.go

15 lines
334 B
Go

package jsonrpc2
// AsyncHandler wraps a Handler such that each request is handled in its own
// goroutine. It is a convenience wrapper.
func AsyncHandler(h Handler) Handler {
return asyncHandler{h}
}
type asyncHandler struct {
Handler
}
func (h asyncHandler) Handle(conn *Conn, req *Request) {
go h.Handler.Handle(conn, req)
}