good morning!!!!

Skip to content
Snippets Groups Projects
Verified Commit cf427a14 authored by a's avatar a
Browse files

oik

parent d5afc247
No related branches found
No related tags found
No related merge requests found
Pipeline #29748 failed
...@@ -8,25 +8,29 @@ import ( ...@@ -8,25 +8,29 @@ import (
"gfx.cafe/open/jrpc/pkg/codec" "gfx.cafe/open/jrpc/pkg/codec"
) )
var _ jrpc.Conn = (*Reconnecting)(nil) var _ jrpc.StreamingConn = (*Reconnecting)(nil)
type Reconnecting struct { type Reconnecting struct {
dialer func(ctx context.Context) (jrpc.Conn, error) dialer func(ctx context.Context) (jrpc.StreamingConn, error)
base codec.Conn base codec.StreamingConn
alive bool alive bool
middleware []codec.Middleware middleware []codec.Middleware
mu sync.Mutex mu sync.Mutex
} }
func NewReconnecting(dialer func(ctx context.Context) (jrpc.Conn, error)) *Reconnecting { func (r *Reconnecting) Notify(ctx context.Context, method string, params any) error {
return r.base.Notify(ctx, method, params)
}
func NewReconnecting(dialer func(ctx context.Context) (jrpc.StreamingConn, error)) *Reconnecting {
r := &Reconnecting{ r := &Reconnecting{
dialer: dialer, dialer: dialer,
} }
return r return r
} }
func (r *Reconnecting) getClient(ctx context.Context) (jrpc.Conn, error) { func (r *Reconnecting) getClient(ctx context.Context) (jrpc.StreamingConn, error) {
reconnect := func() error { reconnect := func() error {
conn, err := r.dialer(ctx) conn, err := r.dialer(ctx)
if err != nil { if err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment