retry connect flex
This commit is contained in:
26
TCPClient.go
26
TCPClient.go
@ -63,19 +63,19 @@ func (c *TCPClient) StartClient() {
|
||||
|
||||
addr, err := net.ResolveTCPAddr("tcp", c.Address+":"+c.Port)
|
||||
if err != nil {
|
||||
c.Log.Error("cannot resolve Telnet Client address:", err)
|
||||
c.Log.Error("Cannot resolve Telnet Client address:", err)
|
||||
}
|
||||
|
||||
c.setDefaultParams()
|
||||
c.Conn, err = net.DialTCP("tcp", nil, addr)
|
||||
if err != nil {
|
||||
c.Log.Error("cannot connect to Telnet Client:", err)
|
||||
c.Log.Error("Cannot connect to Telnet Client:", err)
|
||||
}
|
||||
c.Log.Infof("connected to DX cluster %s:%s", c.Address, c.Port)
|
||||
c.Log.Infof("Connected to DX cluster %s:%s", c.Address, c.Port)
|
||||
|
||||
err = c.Conn.SetKeepAlive(true)
|
||||
if err != nil {
|
||||
c.Log.Error("error while setting keep alive:", err)
|
||||
c.Log.Error("Error while setting keep alive:", err)
|
||||
}
|
||||
|
||||
c.Reader = bufio.NewReader(c.Conn)
|
||||
@ -100,32 +100,32 @@ func (c *TCPClient) Close() {
|
||||
func (c *TCPClient) SetFilters() {
|
||||
if Cfg.Cluster.FT8 {
|
||||
c.Write([]byte("set/ft8\r\n"))
|
||||
c.Log.Debug("FT8 is on as defined in the config file")
|
||||
c.Log.Info("FT8: On")
|
||||
}
|
||||
|
||||
if Cfg.Cluster.Skimmer {
|
||||
c.Write([]byte("set/skimmer\r\n"))
|
||||
c.Log.Debug("Skimmer is on as defined in the config file")
|
||||
c.Log.Info("Skimmer: On")
|
||||
}
|
||||
|
||||
if Cfg.Cluster.FT4 {
|
||||
c.Write([]byte("set/ft4\r\n"))
|
||||
c.Log.Debug("FT4 is on as defined in the config file")
|
||||
c.Log.Info("FT4: On")
|
||||
}
|
||||
|
||||
if !Cfg.Cluster.FT8 {
|
||||
c.Write([]byte("set/noft8\r\n"))
|
||||
c.Log.Debug("FT8 is off as defined in the config file")
|
||||
c.Log.Info("FT8: Off")
|
||||
}
|
||||
|
||||
if !Cfg.Cluster.FT4 {
|
||||
c.Write([]byte("set/noft4\r\n"))
|
||||
c.Log.Debug("FT4 is off as defined in the config file")
|
||||
c.Log.Info("FT4: Off")
|
||||
}
|
||||
|
||||
if !Cfg.Cluster.Skimmer {
|
||||
c.Write([]byte("set/noskimmer\r\n"))
|
||||
c.Log.Debug("Skimmer is off as defined in the config file")
|
||||
c.Log.Info("Skimmer: Off")
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,11 +147,11 @@ func (c *TCPClient) ReadLine() {
|
||||
if Cfg.Cluster.Command != "" {
|
||||
c.WriteString(Cfg.Cluster.Command)
|
||||
}
|
||||
c.Log.Info("start receiving spots")
|
||||
c.Log.Info("Start receiving spots")
|
||||
}
|
||||
|
||||
// start := time.Now()
|
||||
ProcessTelnetSpot(spotRe, message, c.SpotChan, c.Countries)
|
||||
go ProcessTelnetSpot(spotRe, message, c.SpotChan, c.Countries)
|
||||
// elapsed := time.Since(start)
|
||||
// Log.Infof("Total time for processing spot: %s", elapsed)
|
||||
|
||||
@ -159,7 +159,7 @@ func (c *TCPClient) ReadLine() {
|
||||
if len(c.TCPServer.Clients) > 0 {
|
||||
if count == 0 {
|
||||
// wait 3 seconds before sending messages to allow the client to connect
|
||||
time.Sleep(time.Second * 3)
|
||||
time.Sleep(time.Second * 5)
|
||||
count++
|
||||
}
|
||||
c.MsgChan <- message
|
||||
|
Reference in New Issue
Block a user