summaryrefslogtreecommitdiff
path: root/util/isensor.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2020-09-14 12:27:22 +0200
committerJörg Frings-Fürst <debian@jff.email>2020-09-14 12:27:22 +0200
commit0e9b185152b56ff33fe8a2a89a4f84923a308300 (patch)
treea5921c0b328a249f4978fa27c641e13512f16d44 /util/isensor.c
parentc71bf8390b9a06fa498d2cb4f8a4924309f4875e (diff)
New upstream version 3.1.7upstream/3.1.7
Diffstat (limited to 'util/isensor.c')
-rw-r--r--util/isensor.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/util/isensor.c b/util/isensor.c
index 48755b7..b2f2bf9 100644
--- a/util/isensor.c
+++ b/util/isensor.c
@@ -3652,30 +3652,33 @@ int i_sensor(int argc, char **argv)
}
sz = sdrdata[4] + 5;
} else {
- ret = GetSDR(recid,&recnext,sdrdata,sizeof(sdrdata),&sz);
- if (fdebug)
- printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,recnext);
- if (ret != 0) {
- if (ret > 0) { /* ret is a completion code error */
- fprintf(stderr,"%04x GetSDR error 0x%02x %s, rlen=%d\n",
- recid,ret,decode_cc((ushort)0,(uchar)ret),sz);
- if (ret == 0xC5) { /* lost Reservation ID, retry */
- /* This means that some other IPMI software has
- * requested a Reservation before we finished, so
- * we need to refresh the Reservation ID * retry. */
- fDoReserve = 1; /* get a new SDR Reservation ID */
- ret = GetSDR(recid,&recnext,sdrdata,sizeof(sdrdata),&sz);
- if (fdebug)
- printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,
- recnext);
- if (ret == 0xC5) sz = 0; /*failed to get Reservation ID*/
- }
- } else fprintf(stderr,"%04x GetSDR error %d, rlen = %d\n",
- recid,ret,sz);
- if (sz < MIN_SDR_SZ) { /* don't have recnext, so abort */
- break;
- } /* else fall through & continue */
- }
+ int try;
+ for (try = 0; try < 10; try++) {
+ ret = GetSDR(recid,&recnext,sdrdata,sizeof(sdrdata),&sz);
+ if (fdebug)
+ printf("GetSDR[%04x]: ret = %x, next=%x\n",recid,ret,recnext);
+ if (ret != 0) {
+ if (ret == 0xC5) { /* lost Reservation ID, retry */
+ /*fprintf(stderr,"%04x lost reservation retrying to get, try: %d, %d, rlen = %d\n", recid,try,ret,sz);*/
+ os_usleep((rand() & 3000), 0); //_sleep(rand() & 3000);
+ fDoReserve = 1;
+ }
+ else {
+ fprintf(stderr,"%04x GetSDR error %d, rlen = %d\n", recid,ret,sz);
+ break;
+ }
+ }
+ else {
+ break;
+ }
+ if (try==9){
+ sz=0;
+ fprintf(stderr,"%04x GetSDR error %d, rlen = %d\n", recid,ret,sz);
+ }
+ }
+ if (sz < MIN_SDR_SZ) { /* don't have recnext, so abort */
+ break;
+ } /* else fall through & continue */
} /*end-else*/
if (ret == 0) { /* (ret == 0) OK, got full SDR */
if (fdebug) {