MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / Close

Method Close

pkg/component/component.go:420–445  ·  view source on GitHub ↗

Close closes the server.

()

Source from the content-addressed store, hash-verified

418
419// Close closes the server.
420func (c *Component) Close() {
421 c.cancelCtx()
422
423 c.tcpListenersMu.Lock()
424 defer c.tcpListenersMu.Unlock()
425 for _, l := range c.tcpListeners {
426 err := l.Close()
427 if err != nil && c.ctx.Err() == nil {
428 c.logger.WithError(err).Errorf("Error while stopping to listen on %s", l.Addr())
429 continue
430 }
431 c.logger.Debugf("Stopped listening on %s", l.Addr())
432 }
433
434 if c.loopback != nil {
435 c.logger.Debug("Stopping gRPC client...")
436 c.loopback.Close()
437 c.logger.Debug("Stopped gRPC client")
438 }
439
440 if c.GRPC != nil {
441 c.logger.Debug("Stopping gRPC server...")
442 c.GRPC.Stop()
443 c.logger.Debug("Stopped gRPC server")
444 }
445}
446
447// AllowInsecureForCredentials returns `true` if the component was configured to allow transmission of credentials
448// over insecure transports.

Callers 15

TestUpstreamFunction · 0.95
TestDeviceRepositoryFunction · 0.95
TestComponentFunction · 0.95
TestForwarderFunction · 0.95
TestHomeNetworkFunction · 0.95
TestPbaFunction · 0.95
RunMethod · 0.95
TestUpdateVersionInfoFunction · 0.95
TestBatchGetStatusFunction · 0.95

Implementers 1

Componentpkg/component/component.go

Calls 7

CloseMethod · 0.65
ErrorfMethod · 0.65
WithErrorMethod · 0.65
AddrMethod · 0.65
DebugfMethod · 0.65
DebugMethod · 0.65
ErrMethod · 0.45

Tested by 15

TestUpstreamFunction · 0.76
TestDeviceRepositoryFunction · 0.76
TestComponentFunction · 0.76
TestForwarderFunction · 0.76
TestHomeNetworkFunction · 0.76
TestPbaFunction · 0.76
TestUpdateVersionInfoFunction · 0.76
TestBatchGetStatusFunction · 0.76
TestNSHandlerFunction · 0.76