From 578bc4f7a1cc37eb758a4f7f867313c7d90cb5f1 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Sun, 10 Aug 2025 07:40:26 -0400 Subject: [PATCH] Double connexion is preporly detected --- lib/gessql.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/gessql.c b/lib/gessql.c index d2fc1d3..a5aa5e9 100644 --- a/lib/gessql.c +++ b/lib/gessql.c @@ -692,6 +692,7 @@ srv=(SRVTYP *)0; phase=0; proceed=true; while (proceed==true) { + (void) rou_alert(0,"%s JMPDBG phase='%d' connect=%d",OPEP,phase,connect); switch (phase) { case 0 : //lets lock table access if (sql_lock(sqlptr,RMTTBL)==false) { @@ -700,26 +701,24 @@ while (proceed==true) { } break; case 1 : //updating remotes record with links - if (sql_request(sqlptr,upd,RMTTBL,delta,rmtip)==0) - phase++; //Record not existing + if (sql_request(sqlptr,upd,RMTTBL,delta,rmtip)==1) + phase++; //Record is existing break; case 2 : //Let create a record if (sql_request(sqlptr,ins,RMTTBL,rmtip)!=1) { (void) rou_alert(0,"%s Unable to create entry " "for remote ip <%s> in table <%s> (DB trouble?)", OPEP,rmtip,RMTTBL); - phase+=2; } - break; - case 3 : //Let update the record - if (sql_request(sqlptr,ins,RMTTBL,rmtip)!=1) { - (void) rou_alert(0,"%s Unable to create entry " - "for remote ip <%s> in table <%s> (DB trouble?)", - OPEP,rmtip,RMTTBL); - phase++; //No need to return get the connexion number + else { + if (sql_request(sqlptr,ins,RMTTBL,rmtip)!=1) { + (void) rou_alert(0,"%s Unable to create entry " + "for remote ip <%s> in table <%s> (DB trouble?)", + OPEP,rmtip,RMTTBL); + } } break; - case 4 : //lets find the the number of connection + case 3 : //lets find the the number of connection if (sql_mngremote(sqlptr,sql_select,rmtip,&srv)==false) { (void) rou_alert(0,"%s Unable to get record " "for remote ip <%s> in table <%s> (DB trouble?)", @@ -730,7 +729,7 @@ while (proceed==true) { srv=sql_freesrv(srv); } break; - case 5 : //unlock database + case 4 : //unlock database (void) sql_unlock(sqlptr,true); break; default : //SAFE Guard -- 2.47.3