mirror of
https://github.com/openziti/zrok.git
synced 2024-11-27 02:23:23 +01:00
24 lines
673 B
Go
Executable File
24 lines
673 B
Go
Executable File
package agent
|
|
|
|
import (
|
|
"context"
|
|
"github.com/openziti/zrok/agent/agentGrpc"
|
|
"github.com/pkg/errors"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareReply, error) {
|
|
if shr, found := i.a.shares[req.Token]; found {
|
|
logrus.Infof("stopping share '%v'", shr.token)
|
|
if err := shr.handler.Stop(); err != nil {
|
|
logrus.Errorf("error stopping share '%v': %v", shr.token, err)
|
|
}
|
|
|
|
delete(i.a.shares, shr.token)
|
|
logrus.Infof("released share '%v'", shr.token)
|
|
} else {
|
|
return nil, errors.Errorf("agent has no share with token '%v'", req.Token)
|
|
}
|
|
return nil, nil
|
|
}
|