@@ -22,21 +22,6 @@ type Interface interface {
22
22
Wait (ctx context.Context ) error
23
23
}
24
24
25
- var _ Interface = (* Conn )(nil )
26
-
27
- // Conn is a JSON RPC 2 client server connection.
28
- // Conn is bidirectional; it does not have a designated server or client end.
29
- type Conn struct {
30
- handle Handler
31
- cancel Canceler
32
- stream Stream
33
- done chan struct {}
34
- err error
35
- seq int64 // must only be accessed using atomic operations
36
- pendingMu sync.Mutex // protects the pending map
37
- pending map [ID ]chan * Response
38
- }
39
-
40
25
// Handler is an option you can pass to NewConn to handle incoming requests.
41
26
// If the request returns false from IsNotify then the Handler must eventually
42
27
// call Reply on the Conn with the supplied request.
@@ -53,6 +38,21 @@ type Handler func(context.Context, *Conn, *Request)
53
38
// instead.
54
39
type Canceler func (context.Context , * Conn , * Request )
55
40
41
+ // Conn is a JSON RPC 2 client server connection.
42
+ // Conn is bidirectional; it does not have a designated server or client end.
43
+ type Conn struct {
44
+ handle Handler
45
+ cancel Canceler
46
+ stream Stream
47
+ done chan struct {}
48
+ err error
49
+ seq int64 // must only be accessed using atomic operations
50
+ pendingMu sync.Mutex // protects the pending map
51
+ pending map [ID ]chan * Response
52
+ }
53
+
54
+ var _ Interface = (* Conn )(nil )
55
+
56
56
// NewConn creates a new connection object that reads and writes messages from
57
57
// the supplied stream and dispatches incoming messages to the supplied handler.
58
58
func NewConn (ctx context.Context , s Stream , options ... interface {}) * Conn {
0 commit comments