summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b46111d)
raw | patch | inline | side by side (parent: b46111d)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 15:46:36 +0000 (15:46 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Feb 2008 15:46:36 +0000 (15:46 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8875 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-si/gosa-si-server | patch | blob | history | |
gosa-si/modules/DBsqlite.pm | patch | blob | history |
diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server
index e4df616d29fcc7aa0976f2f00487b59bdaf7e1c6..04063e6f320286aeca851f38587d2fa843824c3a 100755 (executable)
--- a/gosa-si/gosa-si-server
+++ b/gosa-si/gosa-si-server
eval{
$msg = &decrypt_msg($crypted_msg, $module_key);
- if ($msg =~ /<xml>/i){
- &main::daemon_log("decrypted_msg: \n$msg", 8);
- $msg_hash = $xml->XMLin($msg, ForceArray=>1);
-
- # check header
- my $header_l = $msg_hash->{'header'};
- if( 1 != @{$header_l} ) {
- die 'header error';
- }
- my $header = @{$header_l}[0];
- if( 0 == length $header) {
- die 'header error';
- }
+ if ($msg =~ /<xml>/i){
+ &main::daemon_log("decrypted_msg: \n$msg", 8);
+ $msg_hash = $xml->XMLin($msg, ForceArray=>1);
+
+ # check header
+ my $header_l = $msg_hash->{'header'};
+ if( 1 != @{$header_l} ) {
+ die 'header error';
+ }
+ my $header = @{$header_l}[0];
+ if( 0 == length $header) {
+ die 'header error';
+ }
- # check source
- my $source_l = $msg_hash->{'source'};
- if( not defined @{$source_l} or 1 != @{$source_l} ) {
- die 'source error';
- }
- my $source = @{$source_l}[0];
- if( 0 == length $source) {
- die 'source error';
- }
+ # check source
+ my $source_l = $msg_hash->{'source'};
+ if( not defined @{$source_l} or 1 != @{$source_l} ) {
+ die 'source error';
+ }
+ my $source = @{$source_l}[0];
+ if( 0 == length $source) {
+ die 'source error';
+ }
- # check target
- my $target_l = $msg_hash->{'target'};
- if( 1 != @{$target_l} ) {
- die'target error';
- }
- my $target = @{$target_l}[0];
- if( 0 == length $target) {
- die 'target error';
- }
- }
+ # check target
+ my $target_l = $msg_hash->{'target'};
+ if( 1 != @{$target_l} ) {
+ die'target error';
+ }
+ my $target = @{$target_l}[0];
+ if( 0 == length $target) {
+ die 'target error';
+ }
+ }
};
if($@) {
&main::daemon_log("WARNING: do not understand the message", 5);
$act_status = $res->{1}->{'status'};
if( $act_status eq "down" ) {
$sql_statement = "DELETE FROM known_server WHERE hostname='$address'";
- $res = $known_clients_db->del_dbentry($sql_statement);
+ $res = $known_server_db->del_dbentry($sql_statement);
daemon_log("WARNING: failed 2x to a send msg to host '$address', delete host from known_server", 3);
}
else {
daemon_log("INFO: try to forward msg '$answer_header' to bus '$bus_address'", 5);
my $sql_statement = "SELECT * FROM known_server WHERE hostname='$bus_address'";
my $query_res = $known_server_db->select_dbentry( $sql_statement );
- my $bus_key = $query_res->{1}->{hostkey};
- &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
+ my $res_length = keys( %{$query_res} );
+ if( $res_length == 0 ){
+ daemon_log("WARNING: send '$answer_header' to '$bus_address' failed, no bus found in known_server", 3);
+ }
+ else {
+ while( my ($hit_num, $hit) = each %{ $query_res } ) {
+ my $bus_key = $hit->{hostkey};
+ &send_msg_to_target($answer, $bus_address, $bus_key, $answer_header);
+ }
+ }
}
next;
}
index 029abcbf4105a3f231c4d0ac641f3009b08d49ac..206620c7cc91286652a0e32eaf16dd38962fe98e 100644 (file)
my $lock = $self->{db_lock};
my $result=(-f $lock);
if($result) {
- &main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found", 8);
+ #&main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found", 8);
usleep 100;
}
return $result;
sub create_lock : locked {
my $self=shift;
my $funcname=shift;
- &main::daemon_log("(".((defined $funcname)?$funcname:"").") Creating Lock (PID ".$$.") ".($self->{db_lock}),8);
+ #&main::daemon_log("(".((defined $funcname)?$funcname:"").") Creating Lock (PID ".$$.") ".($self->{db_lock}),8);
my $lock = $self->{db_lock};
while( -f $lock ) {
- &main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found",8);
+ #&main::daemon_log("(".((defined $funcname)?$funcname:"").") Lock (PID ".$$.") $lock found",8);
sleep 1;
}
sub remove_lock : locked {
my $self=shift;
my $funcname=shift;
- &main::daemon_log("(".((defined $funcname)?$funcname:"").") Removing Lock (PID ".$$.") ".$self->{db_lock}, 8);
+ #&main::daemon_log("(".((defined $funcname)?$funcname:"").") Removing Lock (PID ".$$.") ".$self->{db_lock}, 8);
close($self->{db_lock_handle});
unlink($self->{db_lock});
}