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
46eb1c28
Commit
46eb1c28
authored
Sep 14, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed peer connection bug
parent
9dd896aa
Pipeline
#7989
canceled with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
45 deletions
+45
-45
sidecar.toml
config/sidecar.toml
+15
-15
manager.go
internal/manger/manager.go
+13
-13
config.go
internal/repo/config.go
+17
-17
No files found.
config/sidecar.toml
View file @
46eb1c28
...
...
@@ -35,22 +35,22 @@ report_caller = false
#tlsca = "certs/ca.pem"
#common_name = "localhost"
[[appchain]]
enable
=
true
type
=
"appchain"
did
=
"did:bitxhub:fabappchain:."
plugin
=
"appchain_plugin"
config
=
"fabric"
[[appchain]]
enable
=
true
type
=
"hub"
did
=
"did:bitxhub:chain33:."
plugin
=
"appchain_plugin"
config
=
"chain33"
#
[[appchain]]
#
enable = true
#
type = "appchain"
#
did = "did:bitxhub:fabappchain:."
#
plugin = "appchain_plugin"
#
config = "fabric"
#
#
[[appchain]]
#
enable = true
#
type = "hub"
#
did = "did:bitxhub:chain33:."
#
plugin = "appchain_plugin"
#
config = "chain33"
[peer]
peers
=
[
"
localhost:60011"
,
"localhost:60012"
,
"localhost:60013"
,
"localhost:60014
"
]
connectors
=
[]
peers
=
["
/ip4/127.0.0.1/tcp/4000/p2p/QmYwuTi2MCEF39mjK9EnARPjY3RRaapBatqU67znK2c1Nm","/ip4/127.0.0.1/tcp/4001/ipfs/QmfC33rPPobCDo1WBhAy8VG6ocTiLfZzFb8aaQGqv3MVv3","/ip4/127.0.0.1/tcp/4002/ipfs/QmVtRucwZjzLb2AEd4CRZ2nheLrDEuUymG8zKsfxdg2pic
"]
connectors
=
[
"localhost:60011"
,
"localhost:60012"
,
"localhost:60013"
,
"localhost:60014"
]
providers
=
1
internal/manger/manager.go
View file @
46eb1c28
...
...
@@ -12,26 +12,26 @@ import (
)
type
Manager
struct
{
logger
logrus
.
FieldLogger
Mgr
appchainmgr
.
AppchainMgr
pm
peermgr
.
PeerManager
router
router
.
Router
logger
logrus
.
FieldLogger
appchainMgr
appchainmgr
.
AppchainMgr
pm
peermgr
.
PeerManager
router
router
.
Router
}
func
(
mgr
*
Manager
)
Start
()
error
{
panic
(
"implement me"
)
return
mgr
.
pm
.
Start
(
)
}
func
(
mgr
*
Manager
)
Stop
()
error
{
panic
(
"implement me"
)
return
mgr
.
pm
.
Stop
(
)
}
func
NewManager
(
addr
string
,
router
router
.
Router
,
pm
peermgr
.
PeerManager
,
Mgr
appchainmgr
.
AppchainMgr
,
logger
logrus
.
FieldLogger
)
(
*
Manager
,
error
)
{
am
:=
&
Manager
{
Mgr
:
Mgr
,
logger
:
logger
,
router
:
router
,
pm
:
pm
,
appchainMgr
:
Mgr
,
logger
:
logger
,
router
:
router
,
pm
:
pm
,
}
err
:=
pm
.
RegisterMultiMsgHandler
([]
pb
.
Message_Type
{
...
...
@@ -51,16 +51,16 @@ func (mgr *Manager) handleMessage(s port.Port, msg *pb.Message) {
var
ok
bool
switch
msg
.
Type
{
case
pb
.
Message_APPCHAIN_REGISTER
:
ok
,
res
=
mgr
.
Mgr
.
Register
(
msg
.
Payload
.
Data
)
ok
,
res
=
mgr
.
appchain
Mgr
.
Register
(
msg
.
Payload
.
Data
)
case
pb
.
Message_APPCHAIN_UPDATE
:
ok
,
res
=
mgr
.
Mgr
.
Update
(
msg
.
Payload
.
Data
)
ok
,
res
=
mgr
.
appchain
Mgr
.
Update
(
msg
.
Payload
.
Data
)
case
pb
.
Message_APPCHAIN_GET
:
app
:=
&
appchainmgr
.
Appchain
{}
if
err
:=
json
.
Unmarshal
(
msg
.
Payload
.
Data
,
app
);
err
!=
nil
{
mgr
.
logger
.
Error
(
err
)
return
}
ok
,
res
=
mgr
.
Mgr
.
QueryById
(
app
.
ID
,
nil
)
ok
,
res
=
mgr
.
appchain
Mgr
.
QueryById
(
app
.
ID
,
nil
)
default
:
m
:=
"wrong appchain message type"
res
=
[]
byte
(
m
)
...
...
internal/repo/config.go
View file @
46eb1c28
...
...
@@ -109,26 +109,26 @@ func DefaultConfig() *Config {
},
},
Peer
:
Peer
{
Peers
:
[]
string
{
"localhost:60011"
,
"localhost:60012"
,
"localhost:60013"
,
"localhost:60014"
},
Peers
:
[]
string
{},
Connectors
:
[]
string
{},
Providers
:
1
,
},
Appchains
:
Appchains
{[]
Appchain
{
{
Enable
:
true
,
Type
:
"appchain"
,
DID
:
"did:bitxhub:appchain:."
,
Plugin
:
"appchain_plugin"
,
Config
:
"fabric"
,
},
{
Enable
:
true
,
Type
:
"hub"
,
DID
:
"did:bitxhub:chain33:."
,
Plugin
:
"appchain_plugin"
,
Config
:
"chain33"
,
},
}},
//
Appchains: Appchains{[]Appchain{
//
{
//
Enable: true,
//
Type: "appchain",
//
DID: "did:bitxhub:appchain:.",
//
Plugin: "appchain_plugin",
//
Config: "fabric",
//
},
//
{
//
Enable: true,
//
Type: "hub",
//
DID: "did:bitxhub:chain33:.",
//
Plugin: "appchain_plugin",
//
Config: "chain33",
//
},
//
}},
}
}
...
...
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