Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Async::IO::Endpoint#connect hangs on Windows #53

@emiltin

Description

@emiltin

Hi,
We have an issue with Async::IO::Endpoint#connect on Windows.

On Mac, the methods returns with Errno 61 Connection refused if the server does not respond. But on Windows, it blocks forever if the server does respond within the first 2 seconds.

If server is started first and then client.rb, it works on both Mac and Windows.
But if client.rb is started first, and server.rb is started 2 seconds later or more, it only works on Mac. On Windows, client.rb hangs and never connects.

client.rb:

require 'async'
require 'async/io'

Async do |task|
  endpoint = Async::IO::Endpoint.tcp('127.0.0.1', 13111)
  loop do
    puts "connecting to server"
    endpoint.connect
    puts 'connected'
    exit
  rescue StandardError => e
    task.sleep 1
  end
end

server.rb:

require 'async'
require 'async/io'

Async do
  endpoint = Async::IO::Endpoint.tcp('0.0.0.0', 13111)
  tasks = endpoint.accept do |socket|  # creates async tasks
    puts "client connected"
    exit
  end
  puts "waiting for client"
  tasks.each { |task| task.wait }
end

It might be related to TCP Retransmissions being used on Windows, but not on Mac. See rsmp-nordic/rsmp#22

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions