Skip to content

Commit

Permalink
Merge pull request #1056 from IFTTT/master
Browse files Browse the repository at this point in the history
Replace Async::IO::Socket usage with stdlib Socket…
  • Loading branch information
bblimke committed May 24, 2024
2 parents fc6a2ab + 6cbfed0 commit 0092f5d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/webmock/http_lib_adapters/async_http_client_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,15 @@ def inspect

private

def socket_class
defined?(Async::IO::Socket) ? Async::IO::Socket : Socket
end

def create_connected_sockets
pair = begin
Async::IO::Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM)
socket_class.pair(Socket::AF_UNIX, Socket::SOCK_STREAM)
rescue Errno::EAFNOSUPPORT
Async::IO::Socket.pair(Socket::AF_INET, Socket::SOCK_STREAM)
socket_class.pair(Socket::AF_INET, Socket::SOCK_STREAM)
end
pair.tap do |sockets|
sockets.each do |socket|
Expand Down
2 changes: 1 addition & 1 deletion lib/webmock/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module WebMock
VERSION = '3.23.0' unless defined?(::WebMock::VERSION)
VERSION = '3.23.1' unless defined?(::WebMock::VERSION)
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'ostruct'

module AsyncHttpClientSpecHelper
def http_request(method, url, options = {}, &block)
endpoint = Async::HTTP::Endpoint.parse(url)
Expand Down

0 comments on commit 0092f5d

Please sign in to comment.