ruby-dbus 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS +8 -0
  3. data/README.md +41 -4
  4. data/Rakefile +15 -16
  5. data/VERSION +1 -1
  6. data/lib/dbus.rb +18 -14
  7. data/lib/dbus/bus.rb +32 -168
  8. data/lib/dbus/error.rb +4 -2
  9. data/lib/dbus/export.rb +3 -2
  10. data/lib/dbus/introspect.rb +0 -294
  11. data/lib/dbus/marshall.rb +1 -1
  12. data/lib/dbus/message.rb +8 -0
  13. data/lib/dbus/message_queue.rb +166 -0
  14. data/lib/dbus/proxy_object.rb +149 -0
  15. data/lib/dbus/proxy_object_factory.rb +41 -0
  16. data/lib/dbus/proxy_object_interface.rb +128 -0
  17. data/ruby-dbus.gemspec +1 -0
  18. data/test/{async_test.rb → async_spec.rb} +10 -11
  19. data/test/{binding_test.rb → binding_spec.rb} +23 -25
  20. data/test/bus_and_xml_backend_spec.rb +39 -0
  21. data/test/bus_driver_spec.rb +20 -0
  22. data/test/{bus_test.rb → bus_spec.rb} +8 -7
  23. data/test/byte_array_spec.rb +38 -0
  24. data/test/err_msg_spec.rb +42 -0
  25. data/test/{introspect_xml_parser_test.rb → introspect_xml_parser_spec.rb} +5 -6
  26. data/test/introspection_spec.rb +32 -0
  27. data/test/{main_loop_test.rb → main_loop_spec.rb} +10 -7
  28. data/test/property_spec.rb +53 -0
  29. data/test/server_robustness_spec.rb +66 -0
  30. data/test/{server_test.rb → server_spec.rb} +10 -11
  31. data/test/service_newapi.rb +1 -1
  32. data/test/session_bus_spec_manual.rb +15 -0
  33. data/test/{signal_test.rb → signal_spec.rb} +13 -14
  34. data/test/spec_helper.rb +33 -0
  35. data/test/{thread_safety_test.rb → thread_safety_spec.rb} +5 -6
  36. data/test/type_spec.rb +19 -0
  37. data/test/{value_test.rb → value_spec.rb} +23 -24
  38. data/test/variant_spec.rb +66 -0
  39. metadata +40 -22
  40. data/test/bus_and_xml_backend_test.rb +0 -43
  41. data/test/bus_driver_test.rb +0 -19
  42. data/test/byte_array_test.rb +0 -42
  43. data/test/err_msg_test.rb +0 -59
  44. data/test/introspection_test.rb +0 -32
  45. data/test/property_test.rb +0 -65
  46. data/test/server_robustness_test.rb +0 -73
  47. data/test/session_bus_test_manual.rb +0 -17
  48. data/test/test_helper.rb +0 -14
  49. data/test/type_test.rb +0 -23
  50. data/test/variant_test.rb +0 -67
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d85683483eaee12e0221cc19843e3887a858269a
4
- data.tar.gz: 8aa3af094fe0068807269591395d29d7eb37c7cf
3
+ metadata.gz: dfbf7c6779ae43ca2e0d5774d391bd8bb785bcbf
4
+ data.tar.gz: d8b52f014b2a5bc585099f601385a5bd27dd9ac4
5
5
  SHA512:
6
- metadata.gz: 0493a1b55563d87d202b8cfda861a817d4ab63baa42724505976e64568fad392c2bdcf9a570ea99fe4c32c11ead7dfdc885fbe887e4fc9c7b67540d45c4b0b0d
7
- data.tar.gz: 6d0f2704d4a30ef90b08b93c2e5f9f69750312914dfb7904ad5c9cb13aaaa6cef067dc0484d12b952c1885e747b831731b995526eeb9b39ef6c005ab29315124
6
+ metadata.gz: 1aa32167272f9caa031a723efbef29b72197bfa3837eede6d5615f88f4e643d1a5520b31777bac39e545310bab6a2023b1ee619d65fb26a4b48bf4ec11767ac0
7
+ data.tar.gz: 46cb2c144392a04aee1a718f75e1b2bebf22a1dd1bcee0efb3b262852dc8334578366a4e7e35568a9ceb127131b2f39e52e60690319a51448015fc4dd2f1401a
data/NEWS CHANGED
@@ -5,6 +5,14 @@ Note about bug numbers:
5
5
  Issue#1 - http://github.com/mvidner/ruby-dbus/issues#issue/1
6
6
  bnc#1 - https://bugzilla.novell.com/show_bug.cgi?id=1
7
7
 
8
+ == Ruby D-Bus 0.11.0 - 2014-02-17
9
+
10
+ API:
11
+ * Connection: split off MessageQueue, marked other methods as private.
12
+
13
+ Requirements:
14
+ * converted tests to RSpec, rather mechanically for now
15
+
8
16
  == Ruby D-Bus 0.10.0 - 2014-01-10
9
17
 
10
18
  Bug fixes:
data/README.md CHANGED
@@ -1,13 +1,50 @@
1
- # Ruby D-Bus README
1
+ # Ruby D-Bus
2
2
 
3
- Ruby D-Bus provides an implementation of the D-Bus protocol such that the
4
- D-Bus system can be used in the Ruby programming language.
3
+ [D-Bus](http://dbus.freedesktop.org) is an interprocess communication
4
+ mechanism for Linux.
5
+ Ruby D-Bus is a pure Ruby library for writing clients and services for D-Bus.
6
+
7
+ [![Gem Version][GV img]][Gem Version]
8
+ [![Build Status][BS img]][Build Status]
9
+ [![Dependency Status][DS img]][Dependency Status]
10
+ [![Code Climate][CC img]][Code Climate]
11
+ [![Coverage Status][CS img]][Coverage Status]
12
+
13
+ [Gem Version]: https://rubygems.org/gems/ruby-dbus
14
+ [Build Status]: https://travis-ci.org/mvidner/ruby-dbus
15
+ [travis pull requests]: https://travis-ci.org/mvidner/ruby-dbus/pull_requests
16
+ [Dependency Status]: https://gemnasium.com/mvidner/ruby-dbus
17
+ [Code Climate]: https://codeclimate.com/github/mvidner/ruby-dbus
18
+ [Coverage Status]: https://coveralls.io/r/mvidner/ruby-dbus
19
+
20
+ [GV img]: https://badge.fury.io/rb/ruby-dbus.png
21
+ [BS img]: https://travis-ci.org/mvidner/ruby-dbus.png
22
+ [DS img]: https://gemnasium.com/mvidner/ruby-dbus.png
23
+ [CC img]: https://codeclimate.com/github/mvidner/ruby-dbus.png
24
+ [CS img]: https://coveralls.io/repos/mvidner/ruby-dbus/badge.png?branch=master
25
+
26
+ ## Example
27
+
28
+ Check whether the system is on battery power
29
+ via [UPower](http://upower.freedesktop.org/docs/UPower.html#UPower:OnBattery)
30
+
31
+ require "dbus"
32
+ sysbus = DBus.system_bus
33
+ upower_service = sysbus["org.freedesktop.UPower"]
34
+ upower_object = upower_service.object "/org/freedesktop/UPower"
35
+ upower_object.introspect
36
+ upower_interface = upower_object["org.freedesktop.UPower"]
37
+ on_battery = upower_interface["OnBattery"]
38
+ if on_battery
39
+ puts "The computer IS on battery power."
40
+ else
41
+ puts "The computer IS NOT on battery power."
42
+ end
5
43
 
6
44
  ## Requirements
7
45
 
8
46
  - Ruby 1.9.3 or 2.0
9
47
 
10
- [![Build Status](https://travis-ci.org/mvidner/ruby-dbus.png)](https://travis-ci.org/mvidner/ruby-dbus)
11
48
 
12
49
  ## Installation
13
50
 
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake'
3
3
  require 'fileutils'
4
4
  include FileUtils
5
5
  require 'tmpdir'
6
- require 'rake/testtask'
6
+ require 'rspec/core/rake_task'
7
7
 
8
8
  require "packaging"
9
9
 
@@ -18,24 +18,16 @@ Packaging.configuration do |conf|
18
18
  conf.skip_license_check << /^lib\/dbus\/core_ext\//
19
19
  end
20
20
 
21
- desc 'Default: run tests in the proper environment'
22
- task :default => :test
21
+ desc 'Default: run specs in the proper environment'
22
+ task :default => :spec
23
+ task :test => :spec
23
24
 
24
- def common_test_task(t)
25
- t.libs << "lib"
26
- t.test_files = FileList['test/*_test.rb']
27
- t.verbose = true
25
+ RSpec::Core::RakeTask.new("bare:spec") do |t|
26
+ t.pattern = "**/test/**/*_spec.rb"
27
+ t.rspec_opts = "--color --format doc"
28
28
  end
29
- Rake::TestTask.new("bare:test") {|t| common_test_task t }
30
29
 
31
- begin
32
- require 'rcov/rcovtask'
33
- Rcov::RcovTask.new("bare:rcov") {|t| common_test_task t }
34
- rescue LoadError
35
- # no rcov, never mind
36
- end
37
-
38
- %w(test rcov).each do |tname|
30
+ %w(spec).each do |tname|
39
31
  desc "Run bare:#{tname} in the proper environment"
40
32
  task tname do |t|
41
33
  cd "test/tools" do
@@ -44,6 +36,12 @@ end
44
36
  end
45
37
  end
46
38
 
39
+ if ENV["TRAVIS"]
40
+ require "coveralls/rake/task"
41
+ Coveralls::RakeTask.new
42
+ task :default => "coveralls:push"
43
+ end
44
+
47
45
  #remove tarball implementation and create gem for this gemfile
48
46
  Rake::Task[:tarball].clear
49
47
 
@@ -54,6 +52,7 @@ task :tarball do |t|
54
52
  cd temp do
55
53
  sh "gem build ruby-dbus.gemspec"
56
54
  end
55
+ sh "rm -f package/*.gem"
57
56
  cp Dir.glob("#{temp}/*.gem"), "package"
58
57
  end
59
58
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.10.0
1
+ 0.11.0
@@ -8,21 +8,25 @@
8
8
  # License, version 2.1 as published by the Free Software Foundation.
9
9
  # See the file "COPYING" for the exact licensing terms.
10
10
 
11
- require 'dbus/core_ext/class/attribute'
12
- require 'dbus/type'
13
- require 'dbus/introspect'
14
- require 'dbus/error'
15
- require 'dbus/export'
16
- require 'dbus/bus'
17
- require 'dbus/logger'
18
- require 'dbus/marshall'
19
- require 'dbus/message'
20
- require 'dbus/matchrule'
21
- require 'dbus/auth'
22
- require 'dbus/xml'
11
+ require_relative "dbus/auth"
12
+ require_relative "dbus/bus"
13
+ require_relative "dbus/core_ext/class/attribute"
14
+ require_relative "dbus/error"
15
+ require_relative "dbus/export"
16
+ require_relative "dbus/introspect"
17
+ require_relative "dbus/logger"
18
+ require_relative "dbus/marshall"
19
+ require_relative "dbus/matchrule"
20
+ require_relative "dbus/message"
21
+ require_relative "dbus/message_queue"
22
+ require_relative "dbus/proxy_object"
23
+ require_relative "dbus/proxy_object_factory"
24
+ require_relative "dbus/proxy_object_interface"
25
+ require_relative "dbus/type"
26
+ require_relative "dbus/xml"
23
27
 
24
- require 'socket'
25
- require 'thread'
28
+ require "socket"
29
+ require "thread"
26
30
 
27
31
  # = D-Bus main module
28
32
  #
@@ -11,7 +11,6 @@
11
11
  require 'socket'
12
12
  require 'thread'
13
13
  require 'singleton'
14
- require 'fcntl'
15
14
 
16
15
  # = D-Bus main module
17
16
  #
@@ -187,8 +186,8 @@ module DBus
187
186
  class Connection
188
187
  # The unique name (by specification) of the message.
189
188
  attr_reader :unique_name
190
- # The socket that is used to connect with the bus.
191
- attr_reader :socket
189
+ # pop and push messages here
190
+ attr_reader :message_queue
192
191
 
193
192
  # Create a new connection to the bus for a given connect _path_. _path_
194
193
  # format is described in the D-Bus specification:
@@ -197,93 +196,22 @@ module DBus
197
196
  # "transport1:key1=value1,key2=value2;transport2:key1=value1,key2=value2"
198
197
  # e.g. "unix:path=/tmp/dbus-test" or "tcp:host=localhost,port=2687"
199
198
  def initialize(path)
200
- @path = path
199
+ @message_queue = MessageQueue.new(path)
201
200
  @unique_name = nil
202
- @buffer = ""
203
201
  @method_call_replies = Hash.new
204
202
  @method_call_msgs = Hash.new
205
203
  @signal_matchrules = Hash.new
206
204
  @proxy = nil
207
205
  @object_root = Node.new("/")
208
- @is_tcp = false
209
- end
210
-
211
- # Connect to the bus and initialize the connection.
212
- def connect
213
- addresses = @path.split ";"
214
- # connect to first one that succeeds
215
- worked = addresses.find do |a|
216
- transport, keyvaluestring = a.split ":"
217
- kv_list = keyvaluestring.split ","
218
- kv_hash = Hash.new
219
- kv_list.each do |kv|
220
- key, escaped_value = kv.split "="
221
- value = escaped_value.gsub(/%(..)/) {|m| [$1].pack "H2" }
222
- kv_hash[key] = value
223
- end
224
- case transport
225
- when "unix"
226
- connect_to_unix kv_hash
227
- when "tcp"
228
- connect_to_tcp kv_hash
229
- when "launchd"
230
- connect_to_launchd kv_hash
231
- else
232
- # ignore, report?
233
- end
234
- end
235
- worked
236
- # returns the address that worked or nil.
237
- # how to report failure?
238
- end
239
-
240
- # Connect to a bus over tcp and initialize the connection.
241
- def connect_to_tcp(params)
242
- #check if the path is sufficient
243
- if params.key?("host") and params.key?("port")
244
- begin
245
- #initialize the tcp socket
246
- @socket = TCPSocket.new(params["host"],params["port"].to_i)
247
- @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
248
- init_connection
249
- @is_tcp = true
250
- rescue Exception => e
251
- puts "Oops:", e
252
- puts "Error: Could not establish connection to: #{@path}, will now exit."
253
- exit(1) #a little harsh
254
- end
255
- else
256
- #Danger, Will Robinson: the specified "path" is not usable
257
- puts "Error: supplied path: #{@path}, unusable! sorry."
258
- end
259
206
  end
260
207
 
261
- # Connect to an abstract unix bus and initialize the connection.
262
- def connect_to_unix(params)
263
- @socket = Socket.new(Socket::Constants::PF_UNIX,Socket::Constants::SOCK_STREAM, 0)
264
- @socket.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
265
- if ! params['abstract'].nil?
266
- if HOST_END == LIL_END
267
- sockaddr = "\1\0\0#{params['abstract']}"
268
- else
269
- sockaddr = "\0\1\0#{params['abstract']}"
270
- end
271
- elsif ! params['path'].nil?
272
- sockaddr = Socket.pack_sockaddr_un(params['path'])
208
+ # Dispatch all messages that are available in the queue,
209
+ # but do not block on the queue.
210
+ # Called by a main loop when something is available in the queue
211
+ def dispatch_message_queue
212
+ while (msg = @message_queue.pop(:non_block)) # FIXME EOFError
213
+ process(msg)
273
214
  end
274
- @socket.connect(sockaddr)
275
- init_connection
276
- end
277
-
278
- def connect_to_launchd(params)
279
- socket_var = params['env']
280
- socket = `launchctl getenv #{socket_var}`.chomp
281
- connect_to_unix 'path' => socket
282
- end
283
-
284
- # Send the buffer _buf_ to the bus using Connection#writel.
285
- def send(buf)
286
- @socket.write(buf) unless @socket.nil?
287
215
  end
288
216
 
289
217
  # Tell a bus to register itself on the glib main loop
@@ -292,13 +220,10 @@ module DBus
292
220
  # Circumvent a ruby-glib bug
293
221
  @channels ||= Array.new
294
222
 
295
- gio = GLib::IOChannel.new(@socket.fileno)
223
+ gio = GLib::IOChannel.new(@message_queue.socket.fileno)
296
224
  @channels << gio
297
225
  gio.add_watch(GLib::IOChannel::IN) do |c, ch|
298
- update_buffer
299
- messages.each do |msg|
300
- process(msg)
301
- end
226
+ dispatch_message_queue
302
227
  true
303
228
  end
304
229
  end
@@ -394,6 +319,7 @@ module DBus
394
319
  '
395
320
  # This apostroph is for syntax highlighting editors confused by above xml: "
396
321
 
322
+ # @api private
397
323
  # Send a _message_.
398
324
  # If _reply_handler_ is not given, wait for the reply
399
325
  # and return the reply, or raise the error.
@@ -418,11 +344,12 @@ module DBus
418
344
  reply_handler.call(rmsg, * rmsg.params)
419
345
  end
420
346
  end
421
- send(message.marshall)
347
+ @message_queue.push(message)
422
348
  end
423
349
  ret
424
350
  end
425
351
 
352
+ # @api private
426
353
  def introspect_data(dest, path, &reply_handler)
427
354
  m = DBus::Message.new(DBus::Message::METHOD_CALL)
428
355
  m.path = path
@@ -442,6 +369,7 @@ module DBus
442
369
  end
443
370
  end
444
371
 
372
+ # @api private
445
373
  # Issues a call to the org.freedesktop.DBus.Introspectable.Introspect method
446
374
  # _dest_ is the service and _path_ the object path you want to introspect
447
375
  # If a code block is given, the introspect call in asynchronous. If not
@@ -500,82 +428,22 @@ module DBus
500
428
  @proxy
501
429
  end
502
430
 
503
- # Fill (append) the buffer from data that might be available on the
504
- # socket.
505
- def update_buffer
506
- @buffer += @socket.read_nonblock(MSG_BUF_SIZE)
507
- rescue EOFError
508
- raise # the caller expects it
509
- rescue Exception => e
510
- puts "Oops:", e
511
- raise if @is_tcp # why?
512
- puts "WARNING: read_nonblock failed, falling back to .recv"
513
- @buffer += @socket.recv(MSG_BUF_SIZE)
514
- end
515
-
516
- # Get one message from the bus and remove it from the buffer.
517
- # Return the message.
518
- def pop_message
519
- return nil if @buffer.empty?
520
- ret = nil
521
- begin
522
- ret, size = Message.new.unmarshall_buffer(@buffer)
523
- @buffer.slice!(0, size)
524
- rescue IncompleteBufferException
525
- # fall through, let ret be null
526
- end
527
- ret
528
- end
529
-
530
- # Retrieve all the messages that are currently in the buffer.
531
- def messages
532
- ret = Array.new
533
- while msg = pop_message
534
- ret << msg
535
- end
536
- ret
537
- end
538
-
539
- # The buffer size for messages.
540
- MSG_BUF_SIZE = 4096
541
-
542
- # Update the buffer and retrieve all messages using Connection#messages.
543
- # Return the messages.
544
- def poll_messages
545
- r, d, d = IO.select([@socket], nil, nil, 0)
546
- if r and r.size > 0
547
- update_buffer
548
- end
549
- messages
550
- end
551
-
431
+ # @api private
552
432
  # Wait for a message to arrive. Return it once it is available.
553
433
  def wait_for_message
554
- if @socket.nil?
555
- puts "ERROR: Can't wait for messages, @socket is nil."
556
- return
557
- end
558
- ret = pop_message
559
- while ret == nil
560
- r, d, d = IO.select([@socket])
561
- if r and r[0] == @socket
562
- update_buffer
563
- ret = pop_message
564
- end
565
- end
566
- ret
434
+ @message_queue.pop # FIXME EOFError
567
435
  end
568
436
 
437
+ # @api private
569
438
  # Send a message _m_ on to the bus. This is done synchronously, thus
570
439
  # the call will block until a reply message arrives.
571
440
  def send_sync(m, &retc) # :yields: reply/return message
572
441
  return if m.nil? #check if somethings wrong
573
- send(m.marshall)
442
+ @message_queue.push(m)
574
443
  @method_call_msgs[m.serial] = m
575
444
  @method_call_replies[m.serial] = retc
576
445
 
577
446
  retm = wait_for_message
578
-
579
447
  return if retm.nil? #check if somethings wrong
580
448
 
581
449
  process(retm)
@@ -585,6 +453,7 @@ module DBus
585
453
  end
586
454
  end
587
455
 
456
+ # @api private
588
457
  # Specify a code block that has to be executed when a reply for
589
458
  # message _m_ is received.
590
459
  def on_return(m, &retc)
@@ -620,6 +489,7 @@ module DBus
620
489
  end
621
490
  end
622
491
 
492
+ # @api private
623
493
  # Process a message _m_ based on its type.
624
494
  def process(m)
625
495
  return if m.nil? #check if somethings wrong
@@ -646,17 +516,17 @@ module DBus
646
516
  if not node
647
517
  reply = Message.error(m, "org.freedesktop.DBus.Error.UnknownObject",
648
518
  "Object #{m.path} doesn't exist")
649
- send(reply.marshall)
519
+ @message_queue.push(reply)
650
520
  # handle introspectable as an exception:
651
521
  elsif m.interface == "org.freedesktop.DBus.Introspectable" and
652
522
  m.member == "Introspect"
653
523
  reply = Message.new(Message::METHOD_RETURN).reply_to(m)
654
524
  reply.sender = @unique_name
655
525
  reply.add_param(Type::STRING, node.to_xml)
656
- send(reply.marshall)
526
+ @message_queue.push(reply)
657
527
  else
658
528
  obj = node.object
659
- return if obj.nil? # FIXME, sends no reply
529
+ return if obj.nil? # FIXME, pushes no reply
660
530
  obj.dispatch(m) if obj
661
531
  end
662
532
  when DBus::Message::SIGNAL
@@ -669,6 +539,8 @@ module DBus
669
539
  else
670
540
  DBus.logger.debug "Unknown message type: #{m.message_type}"
671
541
  end
542
+ rescue Exception => ex
543
+ raise m.annotate_exception(ex)
672
544
  end
673
545
 
674
546
  # Retrieves the Service with the given _name_.
@@ -680,6 +552,7 @@ module DBus
680
552
  end
681
553
  alias :[] :service
682
554
 
555
+ # @api private
683
556
  # Emit a signal event for the given _service_, object _obj_, interface
684
557
  # _intf_ and signal _sig_ with arguments _args_.
685
558
  def emit(service, obj, intf, sig, *args)
@@ -693,7 +566,7 @@ module DBus
693
566
  m.add_param(par.type, args[i])
694
567
  i += 1
695
568
  end
696
- send(m.marshall)
569
+ @message_queue.push(m)
697
570
  end
698
571
 
699
572
  ###########################################################################
@@ -712,12 +585,6 @@ module DBus
712
585
  end
713
586
  @service = Service.new(@unique_name, self)
714
587
  end
715
-
716
- # Initialize the connection to the bus.
717
- def init_connection
718
- @client = Client.new(@socket)
719
- @client.authenticate
720
- end
721
588
  end # class Connection
722
589
 
723
590
 
@@ -731,7 +598,6 @@ module DBus
731
598
  # Get the the default session bus.
732
599
  def initialize
733
600
  super(ENV["DBUS_SESSION_BUS_ADDRESS"] || address_from_file || "launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET")
734
- connect
735
601
  send_hello
736
602
  end
737
603
 
@@ -772,7 +638,6 @@ module DBus
772
638
  # Get the default system bus.
773
639
  def initialize
774
640
  super(SystemSocketName)
775
- connect
776
641
  send_hello
777
642
  end
778
643
  end
@@ -793,7 +658,6 @@ module DBus
793
658
  # Get the remote bus.
794
659
  def initialize socket_name
795
660
  super(socket_name)
796
- connect
797
661
  send_hello
798
662
  end
799
663
  end
@@ -829,7 +693,7 @@ module DBus
829
693
 
830
694
  # Add a _bus_ to the list of buses to watch for events.
831
695
  def <<(bus)
832
- @buses[bus.socket] = bus
696
+ @buses[bus.message_queue.socket] = bus
833
697
  end
834
698
 
835
699
  # Quit a running main loop, to be used eg. from a signal handler
@@ -842,7 +706,7 @@ module DBus
842
706
  # before blocking, empty the buffers
843
707
  # https://bugzilla.novell.com/show_bug.cgi?id=537401
844
708
  @buses.each_value do |b|
845
- while m = b.pop_message
709
+ while m = b.message_queue.message_from_buffer_nonblock
846
710
  b.process(m)
847
711
  end
848
712
  end
@@ -852,12 +716,12 @@ module DBus
852
716
  ready.first.each do |socket|
853
717
  b = @buses[socket]
854
718
  begin
855
- b.update_buffer
719
+ b.message_queue.buffer_from_socket_nonblock
856
720
  rescue EOFError, SystemCallError
857
721
  @buses.delete socket # this bus died
858
722
  next
859
723
  end
860
- while m = b.pop_message
724
+ while m = b.message_queue.message_from_buffer_nonblock
861
725
  b.process(m)
862
726
  end
863
727
  end