@@ -49,8 +49,8 @@ type Canceler func(context.Context, *Conn, *Request)
49
49
// Conn is a JSON RPC 2 client server connection.
50
50
// Conn is bidirectional; it does not have a designated server or client end.
51
51
type Conn struct {
52
- handler Handler
53
- canceler Canceler
52
+ Handler Handler
53
+ Canceler Canceler
54
54
logger * zap.Logger
55
55
capacity int
56
56
overloaded bool
@@ -71,14 +71,14 @@ type Options func(*Conn)
71
71
// WithHandler apply custom hander to Conn.
72
72
func WithHandler (h Handler ) Options {
73
73
return func (c * Conn ) {
74
- c .handler = h
74
+ c .Handler = h
75
75
}
76
76
}
77
77
78
78
// WithCanceler apply custom canceler to Conn.
79
79
func WithCanceler (canceler Canceler ) Options {
80
80
return func (c * Conn ) {
81
- c .canceler = canceler
81
+ c .Canceler = canceler
82
82
}
83
83
}
84
84
@@ -139,13 +139,13 @@ func NewConn(ctx context.Context, s Stream, options ...Options) *Conn {
139
139
opt (conn )
140
140
}
141
141
142
- if conn .handler == nil {
142
+ if conn .Handler == nil {
143
143
// the default handler reports a method error
144
- conn .handler = defaultHandler
144
+ conn .Handler = defaultHandler
145
145
}
146
- if conn .canceler == nil {
146
+ if conn .Canceler == nil {
147
147
// the default canceller does nothing
148
- conn .canceler = defaultCanceler
148
+ conn .Canceler = defaultCanceler
149
149
}
150
150
151
151
go func () {
@@ -234,7 +234,7 @@ func (c *Conn) Call(ctx context.Context, method string, params, result interface
234
234
return nil
235
235
236
236
case <- ctx .Done ():
237
- c .canceler (ctx , c , req )
237
+ c .Canceler (ctx , c , req )
238
238
return ctx .Err ()
239
239
}
240
240
}
@@ -369,7 +369,7 @@ func (c *Conn) Run(ctx context.Context) (err error) {
369
369
if e .ctx .Err () != nil {
370
370
continue
371
371
}
372
- c .handler (e .ctx , e .c , e .r )
372
+ c .Handler (e .ctx , e .c , e .r )
373
373
}
374
374
}()
375
375
0 commit comments