Check if accepting socket produced an error

This commit is contained in:
Neil Alexander 2019-01-15 08:53:57 +00:00
parent 2cd373fc1e
commit 53be1b02f3
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -140,6 +140,10 @@ func (iface *tcpInterface) listener() {
iface.core.log.Println("Listening for TCP on:", iface.serv.Addr().String()) iface.core.log.Println("Listening for TCP on:", iface.serv.Addr().String())
for { for {
sock, err := iface.serv.Accept() sock, err := iface.serv.Accept()
if err != nil {
iface.core.log.Println("Failed to accept connection:", err)
return
}
select { select {
case <-iface.serv_stop: case <-iface.serv_stop:
iface.core.log.Println("Stopping listener") iface.core.log.Println("Stopping listener")