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
34086771
Commit
34086771
authored
Sep 10, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimized appchain struct
parent
5aaf11a4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
appchain.go
internal/appchain/appchain.go
+2
-0
port.go
internal/appchain/port.go
+2
-3
No files found.
internal/appchain/appchain.go
View file @
34086771
...
...
@@ -28,6 +28,7 @@ type appChain struct {
ctx
context
.
Context
cancel
context
.
CancelFunc
cryptor
txcrypto
.
Cryptor
msgCh
chan
*
pb
.
Message
}
func
NewPort
(
client
plugins
.
Client
,
cryptor
txcrypto
.
Cryptor
,
logger
logrus
.
FieldLogger
)
(
port
.
Port
,
error
)
{
...
...
@@ -39,6 +40,7 @@ func NewPort(client plugins.Client, cryptor txcrypto.Cryptor, logger logrus.Fiel
recvCh
:
make
(
chan
*
pb
.
IBTP
,
1024
),
ctx
:
ctx
,
cancel
:
cancel
,
msgCh
:
make
(
chan
*
pb
.
Message
,
10
),
},
nil
}
...
...
internal/appchain/port.go
View file @
34086771
...
...
@@ -79,7 +79,6 @@ func (a *appChain) AsyncSend(msg *pb.Message) error {
// ListenIBTPX 监听IBTPX数据。
func
(
a
*
appChain
)
ListenIBTPX
()
<-
chan
*
pb
.
Message
{
ibtpCh
:=
a
.
ListenIBTP
()
msgCh
:=
make
(
chan
*
pb
.
Message
,
10
)
func
()
{
for
{
select
{
...
...
@@ -87,13 +86,13 @@ func (a *appChain) ListenIBTPX() <-chan *pb.Message {
//TODO ibtp to ibtpx
data
,
_
:=
ibtp
.
Marshal
()
msg
:=
pb
.
Msg
(
pb
.
Message_IBTP_SEND
,
true
,
data
)
msgCh
<-
msg
a
.
msgCh
<-
msg
case
<-
a
.
ctx
.
Done
()
:
break
}
}
}()
return
msgCh
return
a
.
msgCh
}
// 同一个接口,不同的实现,行为可以不一样。
...
...
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