class DRbDump::Message

Contains common parts of MessageSend and MessageResult

Public Class Methods

from_stream(drbdump, packet, stream) click to toggle source

Creates the appropriate message instance from the next packet which was captured by drbdump on the given stream.

# File lib/drbdump/message.rb, line 10
def self.from_stream drbdump, packet, stream
  loader = drbdump.loader

  first_chunk = loader.load stream

  case first_chunk.load
  when nil, Integer then
    DRbDump::MessageSend.new drbdump, packet, first_chunk, stream
  when true, false then
    DRbDump::MessageResult.new drbdump, packet, first_chunk, stream
  end
end
new(drbdump, packet) click to toggle source

Initializes a message from packet captured by a drbdump

# File lib/drbdump/message.rb, line 26
def initialize drbdump, packet
  @drbdump     = drbdump
  @loader      = drbdump.loader
  @packet      = packet
  @statistics  = drbdump.statistics

  @source      = nil
  @destination = nil
end

Public Instance Methods

destination() click to toggle source

The resolved destination for the message.

# File lib/drbdump/message.rb, line 39
def destination
  return @destination if @destination

  resolve_addresses

  @destination
end
source() click to toggle source

The resolved source of the message

# File lib/drbdump/message.rb, line 63
def source
  return @source if @source

  resolve_addresses

  @source
end