Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
link33
sidecar
Commits
115d161d
Commit
115d161d
authored
Dec 27, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code
parent
522ebba0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
port.go
internal/peermgr/port.go
+10
-10
No files found.
internal/peermgr/port.go
View file @
115d161d
...
@@ -61,38 +61,38 @@ func (s *sidecar) Receive(msg *pb.Message) {
...
@@ -61,38 +61,38 @@ func (s *sidecar) Receive(msg *pb.Message) {
s
.
rev
<-
msg
s
.
rev
<-
msg
}
}
type
s
tream
struct
{
type
tcpTmpS
tream
struct
{
s
network
.
Stream
s
network
.
Stream
tag
string
tag
string
rev
chan
*
pb
.
Message
rev
chan
*
pb
.
Message
}
}
func
newStream
(
s
network
.
Stream
,
tag
string
)
*
s
tream
{
func
newStream
(
s
network
.
Stream
,
tag
string
)
*
tcpTmpS
tream
{
rec
:=
make
(
chan
*
pb
.
Message
,
port
.
Capacity
)
rec
:=
make
(
chan
*
pb
.
Message
,
port
.
Capacity
)
return
&
s
tream
{
return
&
tcpTmpS
tream
{
s
:
s
,
s
:
s
,
tag
:
tag
,
tag
:
tag
,
rev
:
rec
,
rev
:
rec
,
}
}
}
}
func
(
s
*
s
tream
)
ID
()
string
{
func
(
s
*
tcpTmpS
tream
)
ID
()
string
{
return
s
.
s
.
RemotePeerID
()
return
s
.
s
.
RemotePeerID
()
}
}
func
(
s
*
s
tream
)
Type
()
string
{
func
(
s
*
tcpTmpS
tream
)
Type
()
string
{
return
port
.
Sidecar
return
port
.
Sidecar
}
}
func
(
s
*
s
tream
)
Name
()
string
{
func
(
s
*
tcpTmpS
tream
)
Name
()
string
{
return
s
.
ID
()
return
s
.
ID
()
}
}
func
(
s
*
s
tream
)
Tag
()
string
{
func
(
s
*
tcpTmpS
tream
)
Tag
()
string
{
return
s
.
tag
return
s
.
tag
}
}
func
(
s
*
s
tream
)
Send
(
msg
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
func
(
s
*
tcpTmpS
tream
)
Send
(
msg
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
{
return
Send
(
s
.
s
.
Send
,
msg
)
return
Send
(
s
.
s
.
Send
,
msg
)
}
}
...
@@ -114,7 +114,7 @@ func Send(sender func([]byte) ([]byte, error), msg *pb.Message) (*pb.Message, er
...
@@ -114,7 +114,7 @@ func Send(sender func([]byte) ([]byte, error), msg *pb.Message) (*pb.Message, er
return
m
,
nil
return
m
,
nil
}
}
func
(
s
*
s
tream
)
AsyncSend
(
msg
*
pb
.
Message
)
error
{
func
(
s
*
tcpTmpS
tream
)
AsyncSend
(
msg
*
pb
.
Message
)
error
{
data
,
err
:=
msg
.
Marshal
()
data
,
err
:=
msg
.
Marshal
()
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"marshal message: %w"
,
err
)
return
fmt
.
Errorf
(
"marshal message: %w"
,
err
)
...
@@ -122,6 +122,6 @@ func (s *stream) AsyncSend(msg *pb.Message) error {
...
@@ -122,6 +122,6 @@ func (s *stream) AsyncSend(msg *pb.Message) error {
return
s
.
s
.
AsyncSend
(
data
)
return
s
.
s
.
AsyncSend
(
data
)
}
}
func
(
s
*
s
tream
)
ListenIBTPX
()
<-
chan
*
pb
.
Message
{
func
(
s
*
tcpTmpS
tream
)
ListenIBTPX
()
<-
chan
*
pb
.
Message
{
panic
(
"implement me"
)
panic
(
"implement me"
)
}
}
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