Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
getty
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wei.xuan
getty
Commits
5c8fc02f
Commit
5c8fc02f
authored
Aug 01, 2018
by
hudangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加收包超时处理
parent
939877ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
client.go
rpc/client.go
+8
-4
No files found.
rpc/client.go
View file @
5c8fc02f
...
...
@@ -121,7 +121,7 @@ func NewClient(confFile string) (*Client, error) {
return
c
,
nil
}
func
(
c
*
Client
)
Call
(
service
,
method
string
,
args
interface
{},
reply
interface
{})
error
{
func
(
c
*
Client
)
Call
(
addr
,
protocol
,
service
,
method
string
,
args
interface
{},
reply
interface
{})
error
{
b
:=
&
GettyRPCRequest
{}
b
.
header
.
Service
=
service
b
.
header
.
Method
=
method
...
...
@@ -134,7 +134,7 @@ func (c *Client) Call(service, method string, args interface{}, reply interface{
resp
:=
NewPendingResponse
()
resp
.
reply
=
reply
session
:=
c
.
selectSession
()
session
:=
c
.
selectSession
(
protocol
,
addr
)
if
session
==
nil
{
return
errSessionNotExist
}
...
...
@@ -165,8 +165,12 @@ func (c *Client) Close() {
c
.
registry
=
nil
}
func
(
c
*
Client
)
selectSession
()
getty
.
Session
{
return
nil
func
(
c
*
Client
)
selectSession
(
protocol
,
addr
string
)
getty
.
Session
{
rpcConn
,
err
:=
c
.
pool
.
getConn
(
protocol
,
addr
)
if
err
!=
nil
{
return
nil
}
return
rpcConn
.
selectSession
()
}
func
(
c
*
Client
)
heartbeat
(
session
getty
.
Session
)
error
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment