From 23ff8045db7f4ca684f28e49e95f444ec63b3125 Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 29 Jul 2008 14:54:14 +0000 Subject: [PATCH] Deemon: Fix handling of broken Database Connection fixes #14 git-svn-id: file:///home/jan/tmp/wetterstation/trunk@259 dd492736-c11a-0410-ad51-8c26713eaf7f --- deamon/seriell/main.c | 5 ++++- deamon/seriell/write.c | 3 +++ debian/changelog | 6 ++++++ .../frontend/content/module_sets/set_xml_full.html | 12 ++++++------ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/deamon/seriell/main.c b/deamon/seriell/main.c index 1c67bd8..4b8f653 100644 --- a/deamon/seriell/main.c +++ b/deamon/seriell/main.c @@ -77,7 +77,10 @@ int main(int argc, char *argv[]){ #endif DEBUGOUT1("Programm gestartet\n"); - + + if(signal(SIGPIPE, SIG_IGN) == SIG_ERR) + exit_error(ERROR_SEIINST); + DEBUGOUT1("SIGPIPE ignoriert\n"); if(signal(SIGABRT, exit_sig_handler) == SIG_ERR) exit_error(ERROR_SEIINST); DEBUGOUT1("Signalhandler zum beenden per SIGABRT installiert\n"); diff --git a/deamon/seriell/write.c b/deamon/seriell/write.c index c2a1feb..b7d9c34 100644 --- a/deamon/seriell/write.c +++ b/deamon/seriell/write.c @@ -113,6 +113,9 @@ static void check_create_query_buffer(){ /* Guckt ob Verbindung da und versucht aufzubauen. * gibt 1 zurueck, wenn erfolgreich, sonst 0 */ static int pg_connect(){ + if (PQstatus(connection) == CONNECTION_OK){ + PQexec(connection,"SELECT 1"); /* Status neusetzen erzwingen */ + } if(PQstatus(connection) != CONNECTION_OK){ if (connection == NULL){ if(conn_string == NULL){ diff --git a/debian/changelog b/debian/changelog index 0bf132c..1d55dea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +weatherstation (1.0.16-1) stable; urgency=low + + * Daemon: Fix handling of broken Database Connections + + -- Jan Losinski Wed, 29 Jul 2008 16:53:00 +0100 + weatherstation (1.0.16) stable; urgency=low * Frontend: Adding caching diff --git a/webstuff/frontend/content/module_sets/set_xml_full.html b/webstuff/frontend/content/module_sets/set_xml_full.html index 124eab0..1a63aa2 100644 --- a/webstuff/frontend/content/module_sets/set_xml_full.html +++ b/webstuff/frontend/content/module_sets/set_xml_full.html @@ -1,18 +1,18 @@ - - + + {content:addModule:xmltemp_1} {content:addModule:xmlhum_1} {content:addModule:xmlpress_1} - + {content:addModule:xmltemp_4} {content:addModule:xmlhum_4} - + {content:addModule:xmlwind_2} - + {content:addModule:xmlrain_3} - +