summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Command/UserControl.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-03-18 14:14:50 +0000
committerfukachan <fukachan>2003-03-18 14:14:50 +0000
commit85af504a4bc9ce2e158dfe0cb9dc3750d1cf98f5 (patch)
tree4d869a4c4bf77ca42863854f3712f2eafcb154a1 /fml/lib/FML/Command/UserControl.pm
parent65e91b931c5c5793624e21ead4de8ebe6dadcd73 (diff)
downloadfml8-85af504a4bc9ce2e158dfe0cb9dc3750d1cf98f5.tar.gz
fml8-85af504a4bc9ce2e158dfe0cb9dc3750d1cf98f5.tar.bz2
fml8-85af504a4bc9ce2e158dfe0cb9dc3750d1cf98f5.zip
modify chaddr algorithm: "del() and add()" -> "add() and del()".
# XXX WHICH STEP IS IT BETTER TO UPDATE LIST ? # [I] 1. remove the old address only if $new_address not included. # 2. add the newadderss # [II] 1. add the newadderss # 2. remove the old address only if $new_address not included. # # Plan [II] is better for authentication without reader lock. # Consider the case the process executing chaddr is preempted, and # another distributing process starts to run.
Diffstat (limited to 'fml/lib/FML/Command/UserControl.pm')
-rw-r--r--fml/lib/FML/Command/UserControl.pm33
1 files changed, 21 insertions, 12 deletions
diff --git a/fml/lib/FML/Command/UserControl.pm b/fml/lib/FML/Command/UserControl.pm
index fc95b861..b405de79 100644
--- a/fml/lib/FML/Command/UserControl.pm
+++ b/fml/lib/FML/Command/UserControl.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: UserControl.pm,v 1.28 2003/03/17 13:27:15 fukachan Exp $
+# $FML: UserControl.pm,v 1.29 2003/03/18 10:42:41 fukachan Exp $
#
package FML::Command::UserControl;
@@ -277,36 +277,45 @@ sub _try_chaddr_in_map
# 3. both conditions are o.k., here we go!
# XXX-TODO: this condition is correct ?
# XXX-TODO: we should remove old one when both old and new ones exist.
+ # XXX WHICH STEP IS IT BETTER TO UPDATE LIST ?
+ # [I] 1. remove the old address only if $new_address not included.
+ # 2. add the newadderss
+ # [II] 1. add the newadderss
+ # 2. remove the old address only if $new_address not included.
+ #
+ # Plan [II] is better for authentication without reader lock.
+ # Consider the case the process executing chaddr is preempted, and
+ # another distributing process starts to run.
+ #
if ($is_old_address_ok && $is_new_address_ok) {
- # remove the old address only if $new_address not included.
{
my $obj = new IO::Adapter $map, $config;
- $obj->touch();
-
$obj->open();
- $obj->delete( $old_address_in_map );
+ $obj->add( $new_address );
unless ($obj->error()) {
- Log("delete $old_address from map=$map");
+ Log("add $new_address to map=$map");
}
else {
- LogError("fail to delete $old_address to map=$map");
+ LogError("fail to add $new_address to map=$map");
}
- $obj->close();
+ $obj->close();
}
# restart map to add the new address.
# XXX we need to restart or rewrind map.
{
my $obj = new IO::Adapter $map, $config;
+ $obj->touch();
+
$obj->open();
- $obj->add( $new_address );
+ $obj->delete( $old_address_in_map );
unless ($obj->error()) {
- Log("add $new_address to map=$map");
+ Log("delete $old_address from map=$map");
}
else {
- LogError("fail to add $new_address to map=$map");
+ LogError("fail to delete $old_address to map=$map");
}
- $obj->close();
+ $obj->close();
}
}
}