View | Details | Raw Unified | Return to bug 537401
Collapse All | Expand All

(-)a/lib/dbus/bus.rb (+17 lines)
Lines 12-17 require 'socket' Link Here
12
require 'thread'
12
require 'thread'
13
require 'singleton'
13
require 'singleton'
14
14
15
def dputs(s)
16
  puts "#{$$} #{s}" if $DEBUG
17
end
18
15
# = D-Bus main module
19
# = D-Bus main module
16
#
20
#
17
# Module containing all the D-Bus modules and classes.
21
# Module containing all the D-Bus modules and classes.
Lines 400-406 module DBus Link Here
400
    # Fill (append) the buffer from data that might be available on the
404
    # Fill (append) the buffer from data that might be available on the
401
    # socket.
405
    # socket.
402
    def update_buffer
406
    def update_buffer
407
dputs "UB"
403
      @buffer += @socket.read_nonblock(MSG_BUF_SIZE)
408
      @buffer += @socket.read_nonblock(MSG_BUF_SIZE)
409
dputs @buffer
410
dputs hexdump @buffer
411
    end
412
413
    def hexdump(s)
414
      s.unpack('c*').map{|i| "%02X" % i}.join ":"
404
    end
415
    end
405
416
406
    # Get one message from the bus and remove it from the buffer.
417
    # Get one message from the bus and remove it from the buffer.
Lines 413-418 module DBus Link Here
413
      rescue IncompleteBufferException => e
424
      rescue IncompleteBufferException => e
414
        # fall through, let ret be null
425
        # fall through, let ret be null
415
      end
426
      end
427
dputs "POPPED #{ret}"
416
      ret
428
      ret
417
    end
429
    end
418
430
Lines 531-539 module DBus Link Here
531
          obj.dispatch(m) if obj
543
          obj.dispatch(m) if obj
532
        end
544
        end
533
      when DBus::Message::SIGNAL
545
      when DBus::Message::SIGNAL
546
dputs "PROCESSING SIGNAL #{m}"
534
        @signal_matchrules.each do |elem|
547
        @signal_matchrules.each do |elem|
535
          mr, slot = elem
548
          mr, slot = elem
536
          if mr.match(m)
549
          if mr.match(m)
550
dputs "MATCH"
537
            slot.call(m)
551
            slot.call(m)
538
            return
552
            return
539
          end
553
          end
Lines 689-695 module DBus Link Here
689
        end
703
        end
690
      end
704
      end
691
      while not @quitting and not @buses.empty?
705
      while not @quitting and not @buses.empty?
706
dputs "SELECTING"
692
        ready, dum, dum = IO.select(@buses.keys)
707
        ready, dum, dum = IO.select(@buses.keys)
708
dputs "SELECTED"
693
        ready.each do |socket|
709
        ready.each do |socket|
694
          b = @buses[socket]
710
          b = @buses[socket]
695
          begin
711
          begin
Lines 698-703 module DBus Link Here
698
            @buses.delete socket # this bus died
714
            @buses.delete socket # this bus died
699
            next
715
            next
700
          end
716
          end
717
dputs "WILL POP"
701
          while m = b.pop_message
718
          while m = b.pop_message
702
            b.process(m)
719
            b.process(m)
703
          end
720
          end
(-)a/lib/dbus/message.rb (+6 lines)
Lines 101-106 module DBus Link Here
101
      end
101
      end
102
    end
102
    end
103
103
104
    def to_s
105
      hid = "%#x" % object_id
106
      s = "#<#{self.class}@#{hid} #{message_type}:#{member}>"
107
      s
108
    end
109
104
    # Mark this message as a reply to a another message _m_, taking
110
    # Mark this message as a reply to a another message _m_, taking
105
    # the serial number of _m_ as reply serial and the sender of _m_ as
111
    # the serial number of _m_ as reply serial and the sender of _m_ as
106
    # destination.
112
    # destination.

Return to bug 537401