good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jrpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
jrpc
Commits
cf427a14
Verified
Commit
cf427a14
authored
Oct 24, 2023
by
a
Browse files
Options
Downloads
Patches
Plain Diff
oik
parent
d5afc247
No related branches found
No related tags found
No related merge requests found
Pipeline
#29748
failed
Oct 24, 2023
Stage: test
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/client/reconnecting.go
+9
-5
9 additions, 5 deletions
contrib/client/reconnecting.go
with
9 additions
and
5 deletions
contrib/client/reconnecting.go
+
9
−
5
View file @
cf427a14
...
@@ -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
.
Streaming
Conn
=
(
*
Reconnecting
)(
nil
)
type
Reconnecting
struct
{
type
Reconnecting
struct
{
dialer
func
(
ctx
context
.
Context
)
(
jrpc
.
Conn
,
error
)
dialer
func
(
ctx
context
.
Context
)
(
jrpc
.
Streaming
Conn
,
error
)
base
codec
.
Conn
base
codec
.
Streaming
Conn
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
.
Streaming
Conn
,
error
)
{
reconnect
:=
func
()
error
{
reconnect
:=
func
()
error
{
conn
,
err
:=
r
.
dialer
(
ctx
)
conn
,
err
:=
r
.
dialer
(
ctx
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment