Sha256: 65079e8990f4ce1e2526a788354d03cbb87045340a554bdfa7b9693a658d55ae

Contents?: true

Size: 818 Bytes

Versions: 3

Compression:

Stored size: 818 Bytes

Contents

# -*- ruby -*-

PGHOST   = 'localhost'
PGDB     = 'test'
#SOCKHOST = 'github.com'
SOCKHOST = 'it-trac.laika.com'

# Load pg first, so the libssl.so that libpq is linked against is loaded.
require 'yugabyte_ysql'
$stderr.puts "connecting to postgres://#{PGHOST}/#{PGDB}"
conn = YugabyteYSQL.connect(PGHOST, :dbname => PGDB )

# Now load OpenSSL, which might be linked against a different libssl.
require 'socket'
require 'openssl'
$stderr.puts "Connecting to #{SOCKHOST}"
sock = TCPSocket.open( SOCKHOST, 443 )
ctx = OpenSSL::SSL::SSLContext.new
sock = OpenSSL::SSL::SSLSocket.new( sock, ctx )
sock.sync_close = true

# The moment of truth...
$stderr.puts "Attempting to connect..."
begin
	sock.connect
rescue Errno
	$stderr.puts "Got an error connecting, but no segfault."
else
	$stderr.puts "Nope, no segfault!"
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yugabyte_ysql-0.3 misc/openssl-pg-segfault.rb
yugabyte_ysql-0.2 misc/openssl-pg-segfault.rb
yugabyte_ysql-0.1 misc/openssl-pg-segfault.rb