Commit 92b36583 authored by Claes Sjofors's avatar Claes Sjofors

Sevcli, uknown message at reconnect wasn't freed. sevTimeout added

parent 7d893541
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "pwr.h" #include "pwr.h"
#include "co_cdh.h" #include "co_cdh.h"
#include "co_time.h" #include "co_time.h"
#include "co_cnf.h"
#include "rt_qcom.h" #include "rt_qcom.h"
#include "rt_qcom_msg.h" #include "rt_qcom_msg.h"
#include "rt_sev_msg.h" #include "rt_sev_msg.h"
...@@ -339,10 +340,26 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid, ...@@ -339,10 +340,26 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
sev_sMsgHistDataGetRequest *msg; sev_sMsgHistDataGetRequest *msg;
qcom_sQid tgt; qcom_sQid tgt;
qcom_sPut put; qcom_sPut put;
int tmo = 30000; static int tmo = 0;
qcom_sGet get; qcom_sGet get;
pwr_tStatus lsts; pwr_tStatus lsts;
if ( tmo == 0) {
int value;
char value_str[20];
int nr;
if ( cnf_get_value( "sevTimeout", value_str, sizeof(value_str))) {
nr = sscanf( value_str, "%d", &value);
if ( nr != 1)
tmo = 30000;
else
tmo = 1000 * value;
}
else
tmo = 30000;
}
if ( ctx->server) if ( ctx->server)
tgt.nid = ctx->server; tgt.nid = ctx->server;
else else
...@@ -373,8 +390,10 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid, ...@@ -373,8 +390,10 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
memset( &get, 0, sizeof(get)); memset( &get, 0, sizeof(get));
for (;;) { for (;;) {
rmsg = (sev_sMsgHistDataGet *) qcom_Get(sts, &ctx->qid, &get, 0); rmsg = (sev_sMsgHistDataGet *) qcom_Get(sts, &ctx->qid, &get, 0);
if ( !rmsg) if ( !rmsg)
break; break;
qcom_Free( sts, rmsg);
} }
if ( !qcom_Put( sts, &tgt, &put)) { if ( !qcom_Put( sts, &tgt, &put)) {
...@@ -386,8 +405,9 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid, ...@@ -386,8 +405,9 @@ int sevcli_get_itemdata( pwr_tStatus *sts, sevcli_tCtx ctx, pwr_tOid oid,
for (;;) { for (;;) {
rmsg = (sev_sMsgHistDataGet *) qcom_Get(sts, &ctx->qid, &get, tmo); rmsg = (sev_sMsgHistDataGet *) qcom_Get(sts, &ctx->qid, &get, tmo);
if ( *sts == QCOM__TMO || !rmsg) if ( *sts == QCOM__TMO || !rmsg) {
return 0; return 0;
}
if ( get.type.b == sev_cMsgClass && if ( get.type.b == sev_cMsgClass &&
get.type.s == (qcom_eStype) sev_eMsgType_HistDataGet && get.type.s == (qcom_eStype) sev_eMsgType_HistDataGet &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment