Skip to content

Commit 66b6605

Browse files
committed
handler: export EmptyHandler
1 parent 8706316 commit 66b6605

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

handler.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ func (d Direction) String() string {
8383
}
8484
}
8585

86-
// emptyHandler represents a empty handler which implements Handler interface.
87-
type emptyHandler struct{}
86+
// EmptyHandler represents a empty handler which implements Handler interface.
87+
type EmptyHandler struct{}
8888

8989
// compile time check whether the emptyHandler implements Handler interface.
90-
var _ Handler = (*emptyHandler)(nil)
90+
var _ Handler = (*EmptyHandler)(nil)
9191

92-
func (emptyHandler) Deliver(ctx context.Context, r *Request, delivered bool) bool {
92+
func (EmptyHandler) Deliver(ctx context.Context, r *Request, delivered bool) bool {
9393
if delivered {
9494
return false
9595
}
@@ -102,26 +102,26 @@ func (emptyHandler) Deliver(ctx context.Context, r *Request, delivered bool) boo
102102
}
103103

104104
// Cancel implements Handler interface.
105-
func (emptyHandler) Cancel(context.Context, *Conn, ID, bool) bool { return false }
105+
func (EmptyHandler) Cancel(context.Context, *Conn, ID, bool) bool { return false }
106106

107107
// Request implements Handler interface.
108-
func (emptyHandler) Request(ctx context.Context, _ *Conn, _ Direction, _ *WireRequest) context.Context {
108+
func (EmptyHandler) Request(ctx context.Context, _ *Conn, _ Direction, _ *WireRequest) context.Context {
109109
return ctx
110110
}
111111

112112
// Response implements Handler interface.
113-
func (emptyHandler) Response(ctx context.Context, _ *Conn, _ Direction, _ *WireResponse) context.Context {
113+
func (EmptyHandler) Response(ctx context.Context, _ *Conn, _ Direction, _ *WireResponse) context.Context {
114114
return ctx
115115
}
116116

117117
// Done implements Handler interface.
118-
func (emptyHandler) Done(context.Context, error) {}
118+
func (EmptyHandler) Done(context.Context, error) {}
119119

120120
// Read implements Handler interface.
121-
func (emptyHandler) Read(ctx context.Context, _ int64) context.Context { return ctx }
121+
func (EmptyHandler) Read(ctx context.Context, _ int64) context.Context { return ctx }
122122

123123
// Write implements Handler interface.
124-
func (emptyHandler) Write(ctx context.Context, _ int64) context.Context { return ctx }
124+
func (EmptyHandler) Write(ctx context.Context, _ int64) context.Context { return ctx }
125125

126126
// Error implements Handler interface.
127-
func (emptyHandler) Error(context.Context, error) {}
127+
func (EmptyHandler) Error(context.Context, error) {}

jsonrpc2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func NewConn(s Stream, options ...Options) *Conn {
7171

7272
// the default handler reports a method error
7373
if conn.handlers == nil {
74-
h := emptyHandler{}
74+
h := EmptyHandler{}
7575
conn.handlers = []Handler{h}
7676
}
7777
// the default Logger does nothing

0 commit comments

Comments
 (0)