Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ACS
Public
Cloud
MAS
clonemap
Commits
8b337434
Commit
8b337434
authored
Jun 04, 2020
by
Stefan Dähling
Browse files
agency handle agent delete
parent
4bc79752
Pipeline
#290188
passed with stages
in 2 minutes and 36 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
pkg/agency/acc.go
View file @
8b337434
...
...
@@ -98,6 +98,10 @@ func (agency *Agency) aclLookup(agentID int) (acl *ACL, err error) {
err
=
errors
.
New
(
"MassiveError"
)
return
}
if
address
.
Agency
==
""
{
err
=
errors
.
New
(
"Receiver is not active"
)
return
}
var
remAgency
*
remoteAgency
agency
.
mutex
.
Lock
()
remAgency
,
ok
=
agency
.
remoteAgencies
[
address
.
Agency
]
...
...
@@ -222,6 +226,12 @@ func (agency *Agency) receiveMsgs() {
return
}
}
}
else
{
_
,
err
:=
agencyclient
.
ReturnMsg
(
msgs
[
i
]
.
AgencySender
,
msgs
[
i
])
if
err
!=
nil
{
agency
.
logError
.
Println
(
err
)
return
}
}
}
}
...
...
pkg/agency/agency.go
View file @
8b337434
...
...
@@ -227,6 +227,16 @@ func (agency *Agency) getAgentStatus(agentID int) (ret schemas.Status, err error
// removeAgent creates a new mas according to masconfig
func
(
agency
*
Agency
)
removeAgent
(
agentID
int
)
(
err
error
)
{
agency
.
mutex
.
Lock
()
ag
,
ok
:=
agency
.
localAgents
[
agentID
]
agency
.
mutex
.
Unlock
()
if
!
ok
{
return
}
ag
.
Terminate
()
agency
.
mutex
.
Lock
()
delete
(
agency
.
localAgents
,
agentID
)
agency
.
mutex
.
Unlock
()
return
}
...
...
pkg/agency/handler.go
View file @
8b337434
...
...
@@ -80,7 +80,7 @@ func (agency *Agency) handleAPI(w http.ResponseWriter, r *http.Request) {
cmapErr
,
httpErr
=
agency
.
handleMsgs
(
w
,
r
)
resvalid
=
true
}
else
if
respath
[
2
]
==
"agency"
&&
respath
[
3
]
==
"msgundeliv"
{
cmapErr
,
httpErr
=
agency
.
handleMsg
s
(
w
,
r
)
cmapErr
,
httpErr
=
agency
.
handle
Undeliverable
Msg
(
w
,
r
)
resvalid
=
true
}
case
5
:
...
...
Write
Preview
Supports
Markdown
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