[libnet-dbus-perl] 56/335: Add a static "default" instance of the reactor. Check the callbacks actually delete when in remove_* methods to catch errors by caller
Intrigeri
intrigeri at moszumanska.debian.org
Sat Mar 21 01:07:23 UTC 2015
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to branch experimental
in repository libnet-dbus-perl.
commit 510f16f70860ad6e96d63c4b23cbfe32a396e699
Author: Daniel P. Berrange <dan at berrange.com>
Date: Sun Aug 14 17:52:27 2005 +0000
Add a static "default" instance of the reactor. Check the callbacks actually delete when in remove_* methods to catch errors by caller
---
lib/Net/DBus/Reactor.pm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/lib/Net/DBus/Reactor.pm b/lib/Net/DBus/Reactor.pm
index ba8ec22..8fe3d4c 100644
--- a/lib/Net/DBus/Reactor.pm
+++ b/lib/Net/DBus/Reactor.pm
@@ -133,6 +133,15 @@ sub new {
return $self;
}
+use vars qw($main_reactor);
+
+sub main {
+ my $class = shift;
+ $main_reactor = $class->new() unless defined $main_reactor;
+ return $main_reactor;
+}
+
+
=pod
=item $reactor->manage($connection);
@@ -555,6 +564,9 @@ sub remove_timeout {
my $self = shift;
my $key = shift;
+ die "no timeout active with key '$key'"
+ unless defined $self->{timeouts}->[$key];
+
$self->{timeouts}->[$key] = undef;
}
@@ -628,6 +640,10 @@ sub remove_hook {
my $self = shift;
my $key = shift;
+ die "no hook present with key '$key'"
+ unless defined $self->{hooks}->[$key];
+
+
$self->{hooks}->[$key] = undef;
}
@@ -696,6 +712,9 @@ sub _remove {
my $type = shift;
my $fd = shift;
+ die "no handle ($type) active with fd '$fd'"
+ unless exists $self->{fds}->{$type}->{$fd};
+
delete $self->{fds}->{$type}->{$fd};
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-dbus-perl.git
More information about the Pkg-perl-cvs-commits
mailing list