Loop on errors, rather than failing
This commit is contained in:
10
main.go
10
main.go
@@ -35,10 +35,10 @@ func Forward(server *tsnet.Server, proto, port, dst string, finish chan error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
finish <- err
|
finish <- err
|
||||||
}
|
}
|
||||||
defer ln.Close()
|
defer ln.Close();
|
||||||
err = netforward.Forward(Dialer { proto: proto, addr: dst }, ln)
|
for true {
|
||||||
if err != nil {
|
err = netforward.Forward(Dialer { proto: proto, addr: dst }, ln);
|
||||||
finish <- err
|
log.Print(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +64,4 @@ func main() {
|
|||||||
proto, port, dst := args[0], args[1], args[2]
|
proto, port, dst := args[0], args[1], args[2]
|
||||||
go Forward(s, proto, port, dst, err_chan);
|
go Forward(s, proto, port, dst, err_chan);
|
||||||
}
|
}
|
||||||
err := <- err_chan
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user