mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-04 12:03:41 +02:00
main.go: in readerLoop() bail out of function if error returned from shClient.Read is "socket closed".
This commit is contained in:
parent
7a24e9d684
commit
433b23b77b
1 changed files with 9 additions and 2 deletions
11
main.go
11
main.go
|
|
@ -78,14 +78,21 @@ func readerLoop() {
|
||||||
case RS_READ:
|
case RS_READ:
|
||||||
err := shClient.Read()
|
err := shClient.Read()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Error("Failed to read from ship")
|
|
||||||
|
|
||||||
if shErr, ok := err.(shipclient.ShipClientError); ok {
|
if shErr, ok := err.(shipclient.ShipClientError); ok {
|
||||||
|
|
||||||
|
// Bail out if socket is closed
|
||||||
|
if shErr.Type == shipclient.ErrSockClosed {
|
||||||
|
log.Info("Socket closed, Exiting")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Reconnect
|
// Reconnect
|
||||||
if shErr.Type == shipclient.ErrSockRead || shErr.Type == shipclient.ErrNotConnected {
|
if shErr.Type == shipclient.ErrSockRead || shErr.Type == shipclient.ErrNotConnected {
|
||||||
state = RS_CONNECT
|
state = RS_CONNECT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.WithError(err).Error("Failed to read from ship")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue