summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 25d3fe0)
raw | patch | inline | side by side (parent: 25d3fe0)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 13:43:38 +0000 (13:43 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 13:43:38 +0000 (13:43 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8861 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-client | patch | blob | history |
diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client
index 86bae5f7f0f28dfd127c59481307dc1116a0a6fc..a63346b9f92e915fc1e656b1ef6295a4dbc4158f 100755 (executable)
--- a/gosa-si/gosa-si-client
+++ b/gosa-si/gosa-si-client
# default variables
our $REGISTERED = 0;
+my $try_to_register = 0;
%cfg_defaults = (
"general" =>
}
+sub write_to_file {
+ my ($string, $file) = @_;
+ my $error = 0;
+
+ if( not defined $file || not -f $file ) {
+ &main::daemon_log("ERROR: $0: check '-f file' failed: $file", 1);
+ $error++;
+ }
+ if( not defined $string || 0 == length($string)) {
+ &main::daemon_log("ERROR: $0: empty string to write to file '$file'", 1);
+ $error++;
+ }
+
+ if( $error == 0 ) {
+
+ chomp($string);
+
+ open(FILE, ">> $file");
+ print FILE $string."\n";
+ close(FILE);
+ }
+
+ return;
+}
+
+
sub open_socket {
my ($PeerAddr, $PeerPort) = @_ ;
if(defined($PeerPort)){
my ($kernel) = $_[KERNEL];
if( not $REGISTERED ) {
+ $try_to_register++;
+ if( $try_to_register > 1 ) {
+ &write_to_file("gosa-si-no-server-available", $fai_logpath);
+ }
# create new passwd and ciphering object for client-server communication
$server_key = &create_passwd();
# fetch first gosa-si-server from @servers
my $server = shift(@servers);
- if( !$server ) {
- daemon_log("no gosa-si-server left in list of servers", 1);
- daemon_log("unable to register at a gosa-si-server, force shutdown", 1);
- exit(1);
- }
+
+ # append shifted gosa-si-server at the end of @servers, so looking for servers never stop
+ push( @servers, $server );
# Check if our ip is resolvable - if not: don't try to register
my $ip= &get_local_ip_for_remote_ip(sprintf("%s", $server =~ /^([0-9\.]*?):.*$/));
$client_address= "$client_ip:$client_port";
last;
} else {
+ # wait 1 sec until trying to register again
+ sleep(1);
next;
}
}
+
+
+
daemon_log("waiting for msg 'register_at_gosa_si_server'",1);
# $kernel->delay_set('register_at_gosa_si_server', 180);
$kernel->delay_set('register_at_gosa_si_server', 5);