From: rettenbe Date: Mon, 28 Jan 2008 16:23:08 +0000 (+0000) Subject: bug fixed: doubble lock at db while client registration X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a02d8b89f19d926ff8686a58f56166509ff02053;p=gosa.git bug fixed: doubble lock at db while client registration git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8624 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index b51bd4ed1..4f298ee03 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -572,8 +572,7 @@ $known_server_db->create_table('known_server', \@server_col_names); # check wether all modules are gosa-si valid passwd check # create session for repeatedly checking the job queue for jobs -POE::Session->create -( +POE::Session->create( inline_states => { _start => \&trigger_db_loop, watch_for_new_jobs => \&watch_for_new_jobs, @@ -581,11 +580,9 @@ POE::Session->create ); # create socket for incoming xml messages -POE::Component::Server::TCP->new -( +POE::Component::Server::TCP->new( Port => $server_port, ClientInput => \&client_input, - Concurrency => 10, ); daemon_log("start socket for incoming xml messages at port '$server_port' ", 1); diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index 97d3edf16..92de527ab 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -102,7 +102,7 @@ sub add_dbentry { my $sql_statement = "SELECT MAX(CAST(id AS INTEGER)) FROM $table"; &create_lock($self,'add_dbentry'); my $max_id = @{ @{ $self->{dbh}->selectall_arrayref($sql_statement) }[0] }[0]; - &remove_lock($self,'add_dbentry'); + &remove_lock($self,'add_dbentry'); if( defined $max_id) { $id = $max_id + 1; } else { @@ -227,14 +227,9 @@ sub select_dbentry { sub show_table { my $self = shift; my $table_name = shift; - #&create_lock($self,'show_table'); - #my @res = @{$self->{dbh}->selectall_arrayref( "SELECT * FROM $table_name ORDER BY timestamp")}; - #&remove_lock($self,'show_table'); my $sql_statement= "SELECT * FROM $table_name ORDER BY timestamp"; - &create_lock($self,'show_table'); my $res= &exec_statement($self, $sql_statement); - &remove_lock($self,'show_table'); my @answer; foreach my $hit (@{$res}) { @@ -262,9 +257,7 @@ sub count_dbentries { my $answer= -1; my $sql_statement= "SELECT * FROM $table"; - &create_lock($self,'count_dbentries'); my $db_answer= &select_dbentry($self, $sql_statement); - &remove_lock($self, 'count_dbentries'); my $count = keys(%{$db_answer}); return $count; diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index 1409411ba..496ce8d4e 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -254,23 +254,23 @@ sub create_ciphering { # RETURNS: socket IO::Socket::INET # DESCRIPTION: open a socket to PeerAddr #=============================================================================== -#sub open_socket { -# my ($PeerAddr, $PeerPort) = @_ ; -# if(defined($PeerPort)){ -# $PeerAddr = $PeerAddr.":".$PeerPort; -# } -# my $socket; -# $socket = new IO::Socket::INET(PeerAddr => $PeerAddr, -# Porto => "tcp", -# Type => SOCK_STREAM, -# Timeout => 5, -# ); -# if(not defined $socket) { -# return; -# } -# &daemon_log("open_socket: $PeerAddr", 7); -# return $socket; -#} +sub open_socket { + my ($PeerAddr, $PeerPort) = @_ ; + if(defined($PeerPort)){ + $PeerAddr = $PeerAddr.":".$PeerPort; + } + my $socket; + $socket = new IO::Socket::INET(PeerAddr => $PeerAddr, + Porto => "tcp", + Type => SOCK_STREAM, + Timeout => 5, + ); + if(not defined $socket) { + return; + } + &daemon_log("open_socket: $PeerAddr", 7); + return $socket; +} sub get_time {