summaryrefslogtreecommitdiff
path: root/NTPConfig.pm
diff options
context:
space:
mode:
authorcarlosg <carlosg>2006-11-27 16:36:33 +0000
committercarlosg <carlosg>2006-11-27 16:36:33 +0000
commitb392f28d7265474ec9ae1343fbd566920b629f60 (patch)
tree28270ab245a07586cd014664c451001cbeedd600 /NTPConfig.pm
parent0da5a0dedd7319aa287c21b536eafb78d7c354d2 (diff)
2006-11-27 Carlos Garnacho <carlosg@gnome.org>
Merge c-dispatcher branch, adds a lightweight dispatcher which raises configuration modules on demand, reducing memory use during inactivity and allowing the development of modules in other languages than Perl. 2006-10-24 Carlos Garnacho <carlosg@gnome.org> * dispatcher/dispatcher.c: exit() on SIGTERM. 2006-10-24 Carlos Garnacho <carlosg@gnome.org> Continued work on the dispatcher, I think it's now feature complete enough to work. * StbObject.pm: base object for s-t-b services, does all initialization and common stuff. * GroupsConfig.pm, HostsConfig.pm, IfacesConfig.pm, NFSConfig.pm, NTPConfig.pm, SMBConfig.pm, ServicesConfig.pm, TimeConfig.pm, UsersConfig.pm: inherit from StbObject, keep message format in a variable to avoid duplicates. * Utils/Platform.pm: move DBus code to Platform.pm. * Platform.pm: added, new DBus object. * Utils/Backend.pm: ensure system and platform. * Init/Services.pm: code improvements for archlinux * dispatcher/dispatcher.c: Add license, make it raise it's own private session bus to spawn configuration modules, cache platform and return it when asked, create a copy of the message to pass around (seems to be necessary by design) * services/*: added, used to raise configuration modules. * configure.in, Makefile.am: added services directory stuff. 2006-10-13 Carlos Garnacho <carlosg@gnome.org> * dispatcher/dispatcher.c (daemonize): added, function to make the dispatcher become a daemon. 2006-10-12 Carlos Garnacho <carlosg@gnome.org> beginnings of a really lightweight dispatcher written in C, this way the modules will only be loaded when necessary, reducing memory usage and allowing to develop modules in other languages than Perl. * dispatcher/dispatcher.c, Makefile.am: added, first draft of the dispatcher, it already forwards messages and sends replies back and tries to raise modules in the session bus * Makefile.am: add the dispatcher directory. * configure.in: require GLib to build the dispatcher, maybe this dep could be dropped at some point in the future, if I don't feel too lazy... * Utils/Backend.pm: remove --no-daemon and --session-bus parameters, should be no longer needed. Add --disable-shutdown for testing purposes, as modules are supposed to shutdown automatically after some inactivity. Add --module parameter to raise a configuration module. * GroupsConfig.pm, HostsConfig.pm, IfacesConfig.pm, NFSConfig.pm, NTPConfig.pm, SMBConfig.pm, ServicesConfig.pm, TimeConfig.pm, UsersConfig.pm: create the DBus object by themselves. * SystemToolsBackends.pl.in: do not create all the DBus objects, just the one we want to raise, this way the script becomes a loader for services instead of a service itself.
Diffstat (limited to 'NTPConfig.pm')
-rw-r--r--NTPConfig.pm18
1 files changed, 11 insertions, 7 deletions
diff --git a/NTPConfig.pm b/NTPConfig.pm
index ba9ec57..04bd39e 100644
--- a/NTPConfig.pm
+++ b/NTPConfig.pm
@@ -22,19 +22,19 @@
package NTPConfig;
-use base qw(Net::DBus::Object);
+use base qw(StbObject);
use Net::DBus::Exporter ($Utils::Backend::DBUS_PREFIX);
use Utils::Backend;
use Time::NTP;
my $OBJECT_NAME = "NTPConfig";
my $OBJECT_PATH = "$Utils::Backend::DBUS_PATH/$OBJECT_NAME";
+my $format = [[ "array", "string" ]];
sub new
{
- my $class = shift;
- my $service = shift;
- my $self = $class->SUPER::new ($service, $OBJECT_PATH);
+ my $class = shift;
+ my $self = $class->SUPER::new ($OBJECT_PATH, $OBJECT_NAME);
bless $self, $class;
@@ -44,13 +44,14 @@ sub new
return $self;
}
-dbus_method ("get", [], [[ "array", "string" ]]);
-dbus_method ("set", [[ "array", "string" ]], []);
-dbus_signal ("changed", []);
+dbus_method ("get", [], $format);
+dbus_method ("set", $format, []);
+#dbus_signal ("changed", []);
sub get
{
my ($self) = @_;
+ $self->SUPER::reset_counter ();
return &Time::NTP::get ();
}
@@ -58,8 +59,11 @@ sub get
sub set
{
my ($self, @config) = @_;
+ $self->SUPER::reset_counter ();
&Time::NTP::set (@config);
}
+my $config = NTPConfig->new ();
+
1;