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
1eedfdd2
Commit
1eedfdd2
authored
Sep 13, 2021
by
suyanlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed type word
parent
4571e7a4
Pipeline
#7986
failed with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
server.go
api/server.go
+9
-9
interface.go
internal/router/interface.go
+0
-1
No files found.
api/server.go
View file @
1eedfdd2
...
...
@@ -81,8 +81,8 @@ func (g *Server) registerAppchain(c *gin.Context) {
}
func
(
g
*
Server
)
sendAppchain
(
c
*
gin
.
Context
,
appchainType
pb
.
Message_Type
)
{
// target
pie
r id
pierID
:=
c
.
Query
(
"pie
r_id"
)
// target
sideca
r id
sidecarID
:=
c
.
Query
(
"sideca
r_id"
)
var
res
pb
.
Response
var
appchain
appchainmgr
.
Appchain
if
err
:=
c
.
BindJSON
(
&
appchain
);
err
!=
nil
{
...
...
@@ -96,7 +96,7 @@ func (g *Server) sendAppchain(c *gin.Context, appchainType pb.Message_Type) {
}
msg
:=
pb
.
Msg
(
appchainType
,
true
,
data
)
ackMsg
,
err
:=
g
.
peerMgr
.
SendByID
(
pie
rID
,
msg
)
ackMsg
,
err
:=
g
.
peerMgr
.
SendByID
(
sideca
rID
,
msg
)
if
err
!=
nil
{
res
.
Data
=
[]
byte
(
err
.
Error
())
c
.
JSON
(
http
.
StatusInternalServerError
,
res
)
...
...
@@ -130,15 +130,15 @@ func (g *Server) handleAckAppchain(c *gin.Context, msg *pb.Message) {
func
(
g
*
Server
)
getAppchain
(
c
*
gin
.
Context
)
{
res
:=
&
response
{}
// target
pie
r id
self
PierID
,
err
:=
g
.
getSelfPie
rID
(
c
)
// target
sideca
r id
self
SidecarID
,
err
:=
g
.
getSelfSideca
rID
(
c
)
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
err
.
Error
())
return
}
target
PierID
:=
c
.
Query
(
"pie
r_id"
)
target
SidecarID
:=
c
.
Query
(
"sideca
r_id"
)
appchain
:=
&
appchainmgr
.
Appchain
{
ID
:
self
Pie
rID
,
ID
:
self
Sideca
rID
,
}
data
,
err
:=
json
.
Marshal
(
appchain
)
...
...
@@ -148,7 +148,7 @@ func (g *Server) getAppchain(c *gin.Context) {
}
msg
:=
pb
.
Msg
(
pb
.
Message_APPCHAIN_GET
,
true
,
data
)
ackMsg
,
err
:=
g
.
peerMgr
.
SendByID
(
target
Pie
rID
,
msg
)
ackMsg
,
err
:=
g
.
peerMgr
.
SendByID
(
target
Sideca
rID
,
msg
)
if
err
!=
nil
{
res
.
Data
=
[]
byte
(
err
.
Error
())
c
.
JSON
(
http
.
StatusInternalServerError
,
res
)
...
...
@@ -158,7 +158,7 @@ func (g *Server) getAppchain(c *gin.Context) {
g
.
handleAckAppchain
(
c
,
ackMsg
)
}
func
(
g
*
Server
)
getSelf
Pie
rID
(
ctx
*
gin
.
Context
)
(
string
,
error
)
{
func
(
g
*
Server
)
getSelf
Sideca
rID
(
ctx
*
gin
.
Context
)
(
string
,
error
)
{
repoRoot
:=
g
.
config
.
RepoRoot
keyPath
:=
filepath
.
Join
(
repoRoot
,
"key.json"
)
...
...
internal/router/interface.go
View file @
1eedfdd2
...
...
@@ -17,7 +17,6 @@ type Router interface {
Adds
(
p
[]
port
.
Port
)
error
//Route sends ibtp to the union pier in target relay chain
Route
(
ibtp
*
pb
.
Message
)
error
Load
(
key
string
)
(
value
port
.
Port
,
ok
bool
)
...
...
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