The first question,When the source code starts, some errors will interrupt the application’s permission. I would like to understand the principle of error interrupt programs and how to solve them. The source code is as follows, the close() method
func (a *App) wait(errChan <-chan error) {
err := <-errChan
a.handleMainServiceError(err)
done := make(chan struct{})
go func() {
a.ll.Close()
close(done)
}()
select {
case <-done:
case <-time.After(10 * time.Second):
l.Warnln("Database failed to stop within 10s")
}
l.Infoln("Exiting")
close(a.stopped)
}
second question,The error log is as follows, which can also interrupt the application. Please analyze the cause of the problem and how to solve it。
[BIKPY] 2023/11/06 10:47:41 INFO: New NAT port mapping: external TCP address 10.10.20.107:46565 to local address [::]:22000.
[BIKPY] 2023/11/06 10:47:41 INFO: Detected 1 NAT service
[BIKPY] 2023/11/06 10:47:41 INFO: quic://0.0.0.0:22000 detected NAT type: Symmetric NAT
[BIKPY] 2023/11/06 10:48:35 INFO: QUIC listener ([::]:22000) shutting down
[BIKPY] 2023/11/06 10:48:35 INFO: Relay listener (dynamic+https://relays.syncthing.net/endpoint) shutting down
[BIKPY] 2023/11/06 10:48:35 INFO: Lost primary connection to JJPORRB at 192.162.68.119:22000-192.162.68.201:22000/tcp-client/TLS1.3-TLS_AES_128_GCM_SHA256/LAN-P10-5SKT2TS8BGM38OT3VPREOA962A: Syncthing is being stopped (0 remain)
[BIKPY] 2023/11/06 10:48:35 INFO: Connection to JJPORRB at 192.162.68.119:22000-192.168.50.201:22000/tcp-client/TLS1.3-TLS_AES_128_GCM_SHA256/LAN-P10-5SKT2TS8BGM38OT3VPREOA962A closed: Syncthing is being stopped
[BIKPY] 2023/11/06 10:48:35 INFO: TCP listener ([::]:22000) shutting down
[BIKPY] 2023/11/06 10:48:35 INFO: Exiting