class Async::IO::TCPServer

Asynchronous TCP server wrappper.

def accept(timeout: nil, task: Task.current)

def accept(timeout: nil, task: Task.current)
	peer, address = async_send(:accept_nonblock, timeout: timeout)
	
	wrapper = TCPSocket.new(peer)
	
	wrapper.timeout = self.timeout
	
	return wrapper, address unless block_given?
	
	begin
		yield wrapper, address
	ensure
		wrapper.close
	end
end

def initialize(*args)

def initialize(*args)
	if args.first.is_a? ::TCPServer
		super(args.first)
	else
		# We assume this operation doesn't block (for long):
		super(::TCPServer.new(*args))
	end
end