fix bug in breakout of loop due to max_frames condition

This commit is contained in:
Robert Johansson
2012-05-13 16:32:17 +09:00
parent fd6e432213
commit 6f76632728

View File

@ -24,7 +24,7 @@
#define MBUS_DEBUG(...) #define MBUS_DEBUG(...)
#endif #endif
static int debug = 1; static int debug = 0;
typedef struct _mbus_variable_vif { typedef struct _mbus_variable_vif {
unsigned vif; unsigned vif;
@ -1558,13 +1558,6 @@ mbus_sendrecv_request(mbus_handle *handle, int address, mbus_frame *reply, int m
{ {
frame_count++; frame_count++;
if ((max_frames > 0) &&
(frame_count > max_frames))
{
// only readout max_frames
break;
}
if (debug) if (debug)
printf("%s: debug: receiving response frame #%d\n", __PRETTY_FUNCTION__, frame_count); printf("%s: debug: receiving response frame #%d\n", __PRETTY_FUNCTION__, frame_count);
@ -1601,7 +1594,8 @@ mbus_sendrecv_request(mbus_handle *handle, int address, mbus_frame *reply, int m
{ {
more_frames = 0; more_frames = 0;
if (reply_data.data_var.more_records_follow) if (reply_data.data_var.more_records_follow &&
((max_frames > 0) && (frame_count < max_frames))) // only readout max_frames
{ {
if (debug) if (debug)
printf("%s: debug: expecting more frames\n", __PRETTY_FUNCTION__); printf("%s: debug: expecting more frames\n", __PRETTY_FUNCTION__);