Skip to content

Instantly share code, notes, and snippets.

@barrucadu
Created August 3, 2016 12:48
Show Gist options
  • Select an option

  • Save barrucadu/715dddfd354606f433776bbee7c1e9c9 to your computer and use it in GitHub Desktop.

Select an option

Save barrucadu/715dddfd354606f433776bbee7c1e9c9 to your computer and use it in GitHub Desktop.
for {
// Connect
netConn, err := net.DialTimeout("tcp", c.addr, 5*time.Second)
if err != nil {
logger.Printf("Failed to connect to Stagger: %s", err.Error())
time.Sleep(time.Second)
continue
}
connection = conn.NewConn(netConn, encoding.Encoding{})
if err := connection.WriteMessage(conn.RegisterProcess{Tags: c.tags}); err != nil {
logger.Printf("Failed to register process: %s", err.Error())
time.Sleep(time.Second)
continue
}
// Run the client until it terminates.
err = c.runOnce(connection)
logger.Printf("Lost connection to Stagger: %s", err.Error())
time.Sleep(time.Second)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment