class Mingle::Io::Stream::MinglePeer
Public Class Methods
open( *argv )
click to toggle source
# File lib/mingle/io/stream.rb, line 131 def self.open( *argv ) res = self.send( :new, *argv ) res.send( :start ) res end
Private Class Methods
new( *argv )
click to toggle source
# File lib/bitgirder/core.rb, line 825 def initialize( *argv ) BitGirderClassDefinition.init_instance( self, argv ) end
Public Instance Methods
await_exit( opts = { :expect_success => true } )
click to toggle source
# File lib/mingle/io/stream.rb, line 109 def await_exit( opts = { :expect_success => true } ) not_nil( opts, :opts ) msg = nil begin pid, stat = BitGirder::Io.debug_wait2( :pid => @peer.pid, :name => :peer ) unless stat.success? msg = "Peer #{pid} exited with non-success #{stat.exitstatus}" end rescue Errno::ECHILD msg = "Peer #{pid} appears to have exited already" end if msg if opts[ :expect_success ] then raise msg else warn msg end end end
exchange_message( msg )
click to toggle source
# File lib/mingle/io/stream.rb, line 102 def exchange_message( msg ) @conn.write_message( msg ) @conn.read_message end
Private Instance Methods
start()
click to toggle source
# File lib/mingle/io/stream.rb, line 96 def start @peer = @proc_builder.popen( "r+" ) @conn = Connection.new( :reader => @peer, :writer => @peer ) end