worker: set remoteAddress once on startup

This commit is contained in:
Lars Karlitski 2020-03-25 02:31:18 +01:00 committed by Tom Gundersen
parent ef7e8e0772
commit 16cd243300

View file

@ -67,9 +67,7 @@ func newConnection(remoteAddress string) (net.Conn, error) {
return nil, err
}
address := fmt.Sprintf("%s:%d", remoteAddress, RemoteWorkerPort)
return tls.Dial("tcp", address, conf)
return tls.Dial("tcp", remoteAddress, conf)
}
// plain non-encrypted connection
@ -191,6 +189,10 @@ func main() {
flag.StringVar(&remoteAddress, "remote", "", "Connect to a remote composer using the specified address")
flag.Parse()
if remoteAddress != "" {
remoteAddress = fmt.Sprintf("%s:%d", remoteAddress, RemoteWorkerPort)
}
client := NewClient(remoteAddress)
for {
if err := handleJob(client); err != nil {