Skip to content

Commit

Permalink
socket test: fix JuliaLang#9892 (JuliaLang#24029)
Browse files Browse the repository at this point in the history
ensures that listenany and connect are using the same ipaddr
  • Loading branch information
vtjnash committed Oct 9, 2017
1 parent 1da3faf commit 4f6abd7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/socket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,21 @@ end
wait(tsk)
end

let
# test connecting to a named port
let localhost = getaddrinfo("localhost")
global randport
randport, server = listenany(defaultport)
randport, server = listenany(localhost, defaultport)
@async connect("localhost", randport)
s1 = accept(server)
@test_throws ErrorException("client TCPSocket is not in initialization state") accept(server, s1)
@test_throws Base.UVError("listen", Base.UV_EADDRINUSE) listen(randport)
port2, server2 = listenany(randport)
port2, server2 = listenany(localhost, randport)
@test randport != port2
close(server)
close(server2)
end

@test_throws Base.DNSError connect(".invalid",80)
@test_throws Base.DNSError connect(".invalid", 80)

@testset "UDPSocket" begin
a = UDPSocket()
Expand Down

0 comments on commit 4f6abd7

Please sign in to comment.