Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix test for linux, don't hang after Error writing to socket: Broken … #8559

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions spec/std/openssl/ssl/socket_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@ describe OpenSSL::SSL::Socket do
server_context, client_context = ssl_context_pair

client_successfully_closed_socket = Channel(Nil).new
server_received_socket = Channel(Nil).new
spawn do
OpenSSL::SSL::Server.open(tcp_server, server_context, sync_close: true) do |server|
server_client = server.accept
server_received_socket.send(nil)
# require client to close the socket from its side, without the server closing it, IIS behave this way.
client_successfully_closed_socket.receive
server_client.close
end
end
socket = TCPSocket.new(tcp_server.local_address.address, tcp_server.local_address.port)
socket = OpenSSL::SSL::Socket::Client.new(socket, client_context, hostname: "example.com", sync_close: true)
server_received_socket.receive # make sure connection established
socket.close
client_successfully_closed_socket.send(nil)
end
Expand Down