Commit 35455628 authored by claes's avatar claes

A reply to a resent message wasn't handled correctly

parent ef347371
/* /*
* Proview $Id: remote_pvd_pwrcli.cpp,v 1.2 2007-03-20 12:36:38 claes Exp $ * Proview $Id: remote_pvd_pwrcli.cpp,v 1.3 2007-05-24 07:02:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -120,13 +120,19 @@ void remote_pvd_pwrcli::objectOid( co_procom *pcom, pwr_tOix oix) ...@@ -120,13 +120,19 @@ void remote_pvd_pwrcli::objectOid( co_procom *pcom, pwr_tOix oix)
if ( pvd_cLog) logg( "ObjOid", oix, ""); if ( pvd_cLog) logg( "ObjOid", oix, "");
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg); sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( pvd_cLog) logg( "Reply", sts, "");
if ( EVEN(sts) || sts == REM__TIMEOUT) { if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts); pcom->provideStatus( sts);
return; return;
} }
if ( rmsg->Id != msg.Id) { while ( rmsg->Id != msg.Id) {
dispatch( pcom, (rpvd_sMsg *)rmsg); dispatch( pcom, (rpvd_sMsg *)rmsg);
return;
sts = udp_Receive( (char **)&rmsg, 1000);
if ( sts == REM__TIMEOUT) {
pcom->provideStatus( REM__DISORDER);
return;
}
} }
if ( rmsg->Type != rpvd_eMsg_Object) { if ( rmsg->Type != rpvd_eMsg_Object) {
pcom->provideStatus( REM__DISORDER); pcom->provideStatus( REM__DISORDER);
...@@ -173,9 +179,14 @@ void remote_pvd_pwrcli::objectName( co_procom *pcom, char *name, pwr_tOix poix) ...@@ -173,9 +179,14 @@ void remote_pvd_pwrcli::objectName( co_procom *pcom, char *name, pwr_tOix poix)
pcom->provideStatus( sts); pcom->provideStatus( sts);
return; return;
} }
if ( rmsg->Id != msg.Id) { while ( rmsg->Id != msg.Id) {
dispatch( pcom, (rpvd_sMsg *)rmsg); dispatch( pcom, (rpvd_sMsg *)rmsg);
return;
sts = udp_Receive( (char **)&rmsg, 1000);
if ( sts == REM__TIMEOUT) {
pcom->provideStatus( REM__DISORDER);
return;
}
} }
if ( rmsg->Type != rpvd_eMsg_Object) { if ( rmsg->Type != rpvd_eMsg_Object) {
pcom->provideStatus( REM__DISORDER); pcom->provideStatus( REM__DISORDER);
...@@ -264,9 +275,14 @@ void remote_pvd_pwrcli::writeAttribute( co_procom *pcom, pwr_tOix oix, ...@@ -264,9 +275,14 @@ void remote_pvd_pwrcli::writeAttribute( co_procom *pcom, pwr_tOix oix,
pcom->provideStatus( sts); pcom->provideStatus( sts);
return; return;
} }
if ( rmsg->Id != msg.Id) { while ( rmsg->Id != msg.Id) {
dispatch( pcom, (rpvd_sMsg *)rmsg); dispatch( pcom, (rpvd_sMsg *)rmsg);
return;
sts = udp_Receive( (char **)&rmsg, 1000);
if ( sts == REM__TIMEOUT) {
pcom->provideStatus( REM__DISORDER);
return;
}
} }
if ( rmsg->Type != rpvd_eMsg_Status) { if ( rmsg->Type != rpvd_eMsg_Status) {
pcom->provideStatus( REM__DISORDER); pcom->provideStatus( REM__DISORDER);
...@@ -312,13 +328,19 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix, ...@@ -312,13 +328,19 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix,
if ( pvd_cLog) logg( "Read", aref.Objid.oix, aname); if ( pvd_cLog) logg( "Read", aref.Objid.oix, aname);
sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg); sts = udp_Request( (char *)&msg, sizeof(msg), (char **)&rmsg);
if ( pvd_cLog) logg( "Reply", sts, "");
if ( EVEN(sts) || sts == REM__TIMEOUT) { if ( EVEN(sts) || sts == REM__TIMEOUT) {
pcom->provideStatus( sts); pcom->provideStatus( sts);
return; return;
} }
if ( rmsg->Id != msg.Id) { while ( rmsg->Id != msg.Id) {
dispatch( pcom, (rpvd_sMsg *)rmsg); dispatch( pcom, (rpvd_sMsg *)rmsg);
return;
sts = udp_Receive( (char **)&rmsg, 1000);
if ( sts == REM__TIMEOUT) {
pcom->provideStatus( REM__DISORDER);
return;
}
} }
if ( rmsg->Type != rpvd_eMsg_Attribute) { if ( rmsg->Type != rpvd_eMsg_Attribute) {
pcom->provideStatus( REM__DISORDER); pcom->provideStatus( REM__DISORDER);
...@@ -350,6 +372,9 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix, ...@@ -350,6 +372,9 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix,
ndc_eOp_encode, aref.Offset, 0); ndc_eOp_encode, aref.Offset, 0);
pcom->provideAttr( GDH__SUCCESS, oix, rmsg->Size, p); pcom->provideAttr( GDH__SUCCESS, oix, rmsg->Size, p);
} }
else {
pcom->provideStatus( GDH__NOSUCHCLASS);
}
} }
} }
...@@ -428,16 +453,25 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi ...@@ -428,16 +453,25 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi
pwr_tAttrRef aref; pwr_tAttrRef aref;
pwr_tOName aname; pwr_tOName aname;
pwr_tCid cid; pwr_tCid cid;
pwr_tUInt32 osize;
msg.Type = rpvd_eMsg_SubAdd; msg.Type = rpvd_eMsg_SubAdd;
msg.Id = rpvd_id++; msg.Id = rpvd_id++;
msg.Oid.oix = oix; msg.Oid.oix = oix;
msg.Oid.vid = rpvd_vid; msg.Oid.vid = rpvd_vid;
sts = gdh_GetObjectSize( msg.Oid, &osize);
if ( EVEN(sts)) {
pcom->provideStatus( sts);
return;
}
memset( &aref, 0, sizeof(aref)); memset( &aref, 0, sizeof(aref));
aref.Objid = msg.Oid; aref.Objid = msg.Oid;
aref.Offset = offset; aref.Offset = offset;
aref.Size = size; aref.Size = size;
if ( (int) osize == size)
aref.Flags.b.Object = 1;
sts = gdh_GetObjectClass( msg.Oid, &cid); sts = gdh_GetObjectClass( msg.Oid, &cid);
if ( EVEN(sts)) { if ( EVEN(sts)) {
...@@ -445,12 +479,15 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi ...@@ -445,12 +479,15 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi
return; return;
} }
sts = gdh_ClassAttrrefToAttr( cid, &aref, aname, sizeof(aname)); if ( aref.Flags.b.Object)
if ( EVEN(sts)) { strcpy( aname, "");
pcom->provideStatus( sts); else {
return; sts = gdh_ClassAttrrefToAttr( cid, &aref, aname, sizeof(aname));
if ( EVEN(sts)) {
pcom->provideStatus( sts);
return;
}
} }
strcpy( msg.Attribute, aname); strcpy( msg.Attribute, aname);
msg.Rix = subid.rix; msg.Rix = subid.rix;
msg.Size = size; msg.Size = size;
...@@ -463,9 +500,14 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi ...@@ -463,9 +500,14 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi
pcom->provideStatus( sts); pcom->provideStatus( sts);
return; return;
} }
if ( rmsg->Id != msg.Id) { while ( rmsg->Id != msg.Id) {
dispatch( pcom, (rpvd_sMsg *)rmsg); dispatch( pcom, (rpvd_sMsg *)rmsg);
return;
sts = udp_Receive( (char **)&rmsg, 1000);
if ( sts == REM__TIMEOUT) {
pcom->provideStatus( REM__DISORDER);
return;
}
} }
if ( rmsg->Type != rpvd_eMsg_Status) { if ( rmsg->Type != rpvd_eMsg_Status) {
pcom->provideStatus( REM__DISORDER); pcom->provideStatus( REM__DISORDER);
...@@ -508,9 +550,14 @@ void remote_pvd_pwrcli::subDisassociateBuffer( co_procom *pcom, pwr_tSubid subid ...@@ -508,9 +550,14 @@ void remote_pvd_pwrcli::subDisassociateBuffer( co_procom *pcom, pwr_tSubid subid
pcom->provideStatus( sts); pcom->provideStatus( sts);
return; return;
} }
if ( rmsg->Id != msg.Id) { while ( rmsg->Id != msg.Id) {
dispatch( pcom, (rpvd_sMsg *)rmsg); dispatch( pcom, (rpvd_sMsg *)rmsg);
return;
sts = udp_Receive( (char **)&rmsg, 1000);
if ( sts == REM__TIMEOUT) {
pcom->provideStatus( REM__DISORDER);
return;
}
} }
if ( rmsg->Type != rpvd_eMsg_Status) { if ( rmsg->Type != rpvd_eMsg_Status) {
pcom->provideStatus( REM__DISORDER); pcom->provideStatus( REM__DISORDER);
...@@ -538,9 +585,14 @@ void remote_pvd_pwrcli::subRequest( co_procom *pcom) ...@@ -538,9 +585,14 @@ void remote_pvd_pwrcli::subRequest( co_procom *pcom)
sts = udp_Receive( (char **)&rmsg, 5000); sts = udp_Receive( (char **)&rmsg, 5000);
if ( EVEN(sts) || sts == REM__TIMEOUT) if ( EVEN(sts) || sts == REM__TIMEOUT)
return; return;
if ( rmsg->Id != msg.Id) { while ( rmsg->Id != msg.Id) {
dispatch( pcom, (rpvd_sMsg *)rmsg); dispatch( pcom, (rpvd_sMsg *)rmsg);
return;
sts = udp_Receive( (char **)&rmsg, 1000);
if ( sts == REM__TIMEOUT) {
pcom->provideStatus( REM__DISORDER);
return;
}
} }
// Unpack the message // Unpack the message
......
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