ID: 253 - Fix lanplus retransmission

Retransmission of lanplus request is broken. ipmi_lanplus_send_payload() keeps
current timeout in local variable 'timeout' and increases it by one with each
retransmission. But ipmi_lan_poll_recv() waits for response for session->timeout
seconds, which is not incremented -> the request is retransmitted only once,
when timeout and session->timeout equals. No other retransmissions are ever
sent.

In addition, the time is measured in seconds, therefore 'time(NULL) - ltime'
often equals 'timeout' and retransmission should be sent in this case (i.e.
'xmit' should be set).

Commit for Jan Safranek
This commit is contained in:
Zdenek Styblik 2013-07-07 15:28:13 +00:00
parent a472c382f4
commit dbd2db71f2

View File

@ -2102,7 +2102,7 @@ ipmi_lanplus_send_payload(
int try = 0; int try = 0;
int xmit = 1; int xmit = 1;
time_t ltime; time_t ltime;
uint32_t timeout; uint32_t saved_timeout;
if (!intf->opened && intf->open && intf->open(intf) < 0) if (!intf->opened && intf->open && intf->open(intf) < 0)
return NULL; return NULL;
@ -2111,7 +2111,7 @@ ipmi_lanplus_send_payload(
* The session timeout is initialized in the above interface open, * The session timeout is initialized in the above interface open,
* so it will only be valid after the open completes. * so it will only be valid after the open completes.
*/ */
timeout = session->timeout; saved_timeout = session->timeout;
while (try < session->retry) { while (try < session->retry) {
//ltime = time(NULL); //ltime = time(NULL);
@ -2307,17 +2307,18 @@ ipmi_lanplus_send_payload(
} }
/* only timeout if time exceeds the timeout value */ /* only timeout if time exceeds the timeout value */
xmit = ((time(NULL) - ltime) > timeout); xmit = ((time(NULL) - ltime) >= session->timeout);
usleep(5000); usleep(5000);
if (xmit) { if (xmit) {
/* increment session timeout by 1 second each retry */ /* increment session timeout by 1 second each retry */
timeout++; session->timeout++;
} }
try++; try++;
} }
session->timeout = saved_timeout;
/* IPMI messages are deleted under ipmi_lan_poll_recv() */ /* IPMI messages are deleted under ipmi_lan_poll_recv() */
switch (payload->payload_type) { switch (payload->payload_type) {