List.iter (fun out -> let (_: int32) = DBus.Connection.send bus out in ()) outmsgs;
DBus.Connection.flush bus
);
- let still_connected = DBus.Connection.read_write_dispatch bus 200 in
+ let still_connected = DBus.Connection.read_write bus 200 in
ignore still_connected; (* FIXME we should probably do something more sensible here *)
- let reply =
+ let rec drain () =
match DBus.Connection.pop_message bus with
- | None -> None
- | Some msg -> process_message msg
- in
- maybe (fun reply ->
- Mutex.execute outgoing_mutex (fun () ->
- Queue.push reply outgoing
- )
- ) reply
+ | None -> ()
+ | Some msg ->
+ let reply = process_message msg in
+ maybe (fun reply ->
+ Mutex.execute outgoing_mutex (fun () ->
+ Queue.push reply outgoing
+ )
+ ) reply;
+ drain ()
+ in
+ drain ()
done;
notify_quit state;
()