mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-21 09:58:18 +02:00
Upgrade to github.com/eosswedenorg-go/antelope-ship-client v0.2.3
This commit is contained in:
parent
5fa1dbb504
commit
93479506b6
4 changed files with 20 additions and 46 deletions
|
|
@ -32,7 +32,7 @@ import (
|
|||
|
||||
var conf *config.Config
|
||||
|
||||
var shClient *shipclient.Client
|
||||
var shClient *shipclient.Stream
|
||||
|
||||
// Reader states
|
||||
const (
|
||||
|
|
@ -77,24 +77,7 @@ func readerLoop() {
|
|||
state = RS_READ
|
||||
recon_cnt = 0
|
||||
case RS_READ:
|
||||
err := shClient.Read()
|
||||
if err != nil {
|
||||
if shErr, ok := err.(shipclient.ClientError); ok {
|
||||
|
||||
// Bail out if socket is closed
|
||||
if shErr.Type == shipclient.ErrSockClosed {
|
||||
log.Info("Socket closed, Exiting")
|
||||
return
|
||||
}
|
||||
|
||||
// Reconnect
|
||||
if shErr.Type == shipclient.ErrSockRead || shErr.Type == shipclient.ErrNotConnected {
|
||||
state = RS_CONNECT
|
||||
}
|
||||
}
|
||||
|
||||
log.WithError(err).Error("Failed to read from ship")
|
||||
}
|
||||
log.WithError(shClient.Run()).Error("Failed to read from ship")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -113,11 +96,6 @@ func run() {
|
|||
sig := <-signals
|
||||
log.WithField("signal", sig).Info("Signal received")
|
||||
|
||||
if !shClient.IsOpen() {
|
||||
log.Info("ship client not connected, exiting...")
|
||||
return
|
||||
}
|
||||
|
||||
// Cleanly close the connection by sending a close message.
|
||||
err := shClient.Shutdown()
|
||||
if err != nil {
|
||||
|
|
@ -214,10 +192,10 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
shClient = shipclient.NewClient(func(c *shipclient.Client) {
|
||||
c.StartBlock = conf.Ship.StartBlockNum
|
||||
c.EndBlock = conf.Ship.EndBlockNum
|
||||
c.IrreversibleOnly = conf.Ship.IrreversibleOnly
|
||||
shClient = shipclient.NewStream(func(s *shipclient.Stream) {
|
||||
s.StartBlock = conf.Ship.StartBlockNum
|
||||
s.EndBlock = conf.Ship.EndBlockNum
|
||||
s.IrreversibleOnly = conf.Ship.IrreversibleOnly
|
||||
})
|
||||
|
||||
processor := app.SpawnProccessor(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue