zrok/agent/releaseShare.go

20 lines
509 B
Go
Raw Normal View History

package agent
import (
"context"
"github.com/openziti/zrok/agent/agentGrpc"
2024-09-10 19:46:17 +02:00
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
2024-09-18 17:54:37 +02:00
func (i *agentGrpcImpl) ReleaseShare(_ context.Context, req *agentGrpc.ReleaseShareRequest) (*agentGrpc.ReleaseShareResponse, error) {
2024-09-25 17:06:06 +02:00
if shr, found := i.agent.shares[req.Token]; found {
i.agent.rmShare <- shr
2024-09-12 19:07:27 +02:00
logrus.Infof("released share '%v'", shr.token)
2024-09-10 19:46:17 +02:00
} else {
return nil, errors.Errorf("agent has no share with token '%v'", req.Token)
}
return nil, nil
}