1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/net/smtp - use TCPSocket when UNIXSocket unavailable

This commit is contained in:
MSP-Greg 2020-11-17 08:24:34 -06:00 committed by Hiroshi SHIBATA
parent 2ef3b979bd
commit 64926d5007
Notes: git 2020-11-18 08:13:36 +09:00
2 changed files with 6 additions and 4 deletions

View file

@ -39,7 +39,8 @@ module Net
end
def start_smtpd(starttls)
@server_socket, @client_socket = UNIXSocket.pair
@server_socket, @client_socket = Object.const_defined?(:UNIXSocket) ?
UNIXSocket.pair : Socket.pair(:INET, :STREAM, 0)
@starttls_executed = false
@server_thread = Thread.new(@server_socket) do |s|
s.puts "220 fakeserver\r\n"
@ -125,4 +126,4 @@ module Net
end
end
end unless /mswin|mingw/ =~ RUBY_PLATFORM
end

View file

@ -25,7 +25,8 @@ module Net
end
def start_smtpd(starttls)
@server_socket, @client_socket = UNIXSocket.pair
@server_socket, @client_socket = Object.const_defined?(:UNIXSocket) ?
UNIXSocket.pair : Socket.pair(:INET, :STREAM, 0)
@starttls_executed = false
@server_thread = Thread.new(@server_socket) do |s|
s.puts "220 fakeserver\r\n"
@ -118,4 +119,4 @@ module Net
assert_nothing_raised { smtp.enable_starttls_auto }
end
end
end unless /mswin|mingw/ =~ RUBY_PLATFORM
end