MCPcopy Index your code
hub / github.com/pion/turn / Close

Method Close

server.go:137–162  ·  view source on GitHub ↗

Close stops the TURN Server. It cleans up any associated state and closes all connections it is managing.

()

Source from the content-addressed store, hash-verified

135// Close stops the TURN Server.
136// It cleans up any associated state and closes all connections it is managing.
137func (s *Server) Close() error {
138 var errors []error
139
140 for _, cfg := range s.packetConnConfigs {
141 if err := cfg.PacketConn.Close(); err != nil {
142 errors = append(errors, err)
143 }
144 }
145
146 for _, cfg := range s.listenerConfigs {
147 if err := cfg.Listener.Close(); err != nil {
148 errors = append(errors, err)
149 }
150 }
151
152 if len(errors) == 0 {
153 return nil
154 }
155
156 err := errFailedToClose
157 for _, e := range errors {
158 err = fmt.Errorf("%s; close error (%w) ", err, e) //nolint:errorlint
159 }
160
161 return err
162}
163
164func (s *Server) readListener(l net.Listener, am *allocation.Manager) {
165 for {

Callers 15

TestServerFunction · 0.95
TestSTUNOnlyFunction · 0.95
TestQuotaReachedFunction · 0.95
TestReservationFunction · 0.95
TestDontFragmentFunction · 0.95
RunBenchmarkServerFunction · 0.95
TestTCPClientFunction · 0.95

Calls 1

ErrorfMethod · 0.80

Tested by 15

TestServerFunction · 0.76
TestSTUNOnlyFunction · 0.76
TestQuotaReachedFunction · 0.76
TestReservationFunction · 0.76
TestDontFragmentFunction · 0.76
RunBenchmarkServerFunction · 0.76
TestTCPClientFunction · 0.76