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
a00052d2
Commit
a00052d2
authored
Dec 30, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix panic bug
parent
1ccbb26f
Pipeline
#8410
failed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
16 deletions
+5
-16
swarm.go
internal/peermgr/swarm.go
+3
-9
map.go
internal/port/map.go
+2
-2
interface.go
internal/router/interface.go
+0
-5
No files found.
internal/peermgr/swarm.go
View file @
a00052d2
...
@@ -49,17 +49,15 @@ func New(config *repo.Config, router router.Router, nodePrivKey crypto.PrivateKe
...
@@ -49,17 +49,15 @@ func New(config *repo.Config, router router.Router, nodePrivKey crypto.PrivateKe
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"convert private key: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"convert private key: %w"
,
err
)
}
}
var
ll
string
var
remotes
map
[
string
]
*
peer
.
AddrInfo
id
,
err
:=
peer
.
IDFromPrivateKey
(
libp2pPrivKey
)
id
,
err
:=
peer
.
IDFromPrivateKey
(
libp2pPrivKey
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
return
nil
,
err
}
}
local
:=
newLocal
(
id
,
privKey
)
local
:=
newLocal
(
id
,
privKey
)
ll
,
remotes
,
err
=
loadPeers
(
config
.
Peer
.
Peers
,
libp2pPrivKey
)
ll
,
remotes
,
err
:
=
loadPeers
(
config
.
Peer
.
Peers
,
libp2pPrivKey
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"load peers: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"load peers: %w"
,
err
)
}
}
...
@@ -246,11 +244,7 @@ func (swarm *Swarm) Stop() error {
...
@@ -246,11 +244,7 @@ func (swarm *Swarm) Stop() error {
return
err
return
err
}
}
swarm
.
cancel
()
swarm
.
cancel
()
err
:=
swarm
.
router
.
Stop
()
return
swarm
.
router
.
Stop
()
if
err
!=
nil
{
return
err
}
return
nil
}
}
func
(
swarm
*
Swarm
)
Connect
(
addrInfo
*
peer
.
AddrInfo
)
(
string
,
error
)
{
func
(
swarm
*
Swarm
)
Connect
(
addrInfo
*
peer
.
AddrInfo
)
(
string
,
error
)
{
...
...
internal/port/map.go
View file @
a00052d2
...
@@ -21,8 +21,8 @@ func NewPortMap() *PortMap {
...
@@ -21,8 +21,8 @@ func NewPortMap() *PortMap {
rw
:
sync
.
RWMutex
{},
rw
:
sync
.
RWMutex
{},
peerPort
:
map
[
string
]
Port
{},
peerPort
:
map
[
string
]
Port
{},
appchainPort
:
map
[
string
]
Port
{},
appchainPort
:
map
[
string
]
Port
{},
hubPort
:
nil
,
hubPort
:
nil
,
//TODO
local
:
nil
,
local
:
nil
,
//TODO
}
}
}
}
...
...
internal/router/interface.go
View file @
a00052d2
...
@@ -21,11 +21,6 @@ type Router interface {
...
@@ -21,11 +21,6 @@ type Router interface {
Send
(
id
string
,
msg
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
Send
(
id
string
,
msg
*
pb
.
Message
)
(
*
pb
.
Message
,
error
)
AsyncSend
(
id
string
,
msg
*
pb
.
Message
)
error
AsyncSend
(
id
string
,
msg
*
pb
.
Message
)
error
// InPut(ibtp *pb.IBTP) chan *pb.IBTP
// OutPut(ibtp *pb.IBTP) chan *pb.IBTP
// 代替上面两个方法
// Router(ibtp *pb.IBTP) chan *pb.IBTP
}
}
// 路由规则,根据路由表,rules接口, 这个放到交易内部。可以让用户决定。并且签名。
// 路由规则,根据路由表,rules接口, 这个放到交易内部。可以让用户决定。并且签名。
...
...
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