fix: ooporthelper connection_refused (#974)

Closes https://github.com/ooni/probe/issues/2338

Co-authored-by: decfox <decfox@github.com>
This commit is contained in:
DecFox 2022-10-08 13:56:08 +05:30 committed by GitHub
commit 62e9f8e101
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View file

@ -31,7 +31,7 @@ func shutdown(ctx context.Context, l net.Listener) {
}
// TODO(DecFox): Add the ability of an echo service to generate some traffic
func handleConnetion(ctx context.Context, conn net.Conn) {
func handleConnection(ctx context.Context, conn net.Conn) {
defer conn.Close()
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
@ -48,10 +48,10 @@ func listenTCP(ctx context.Context, port string) {
for {
conn, err := listener.Accept()
if err != nil {
log.Infof("listener unable to accept connections on port%s", port)
log.Infof("listener unable to accept connections on port: %s", port)
return
}
go handleConnetion(ctx, conn)
go handleConnection(ctx, conn)
}
}