[Quickfix-users] Possible Checksum bug originating in FieldBase::setString()
Brought to you by:
orenmnero
From: Brendan B. B. <br...@ka...> - 2003-07-06 10:54:29
|
Hello, In Field.h::void FieldBase::setString( const std::string& string ), shouldn't m_total be inited to 0 before accumulating it? e.g. void { m_string = string; m_data = IntConvertor::convert(m_field) + "=" + string + "\001"; m_length = m_data.length(); const char* iter = m_data.c_str(); const char* end = iter + m_data.length(); // tbd1234: brendan - bug? m_total = 0; while( iter != end ) m_total += *iter++; } W/o this, something like: FIX::ExecType execType; FIX::OrdStatus ordStatus; execType.setValue(FIX::ExecType_NEW); ordStatus.setValue(FIX::OrdStatus_NEW); ...send ExecReport... would cause a checksum mismatch between executor and a client due to these two fields. In addition to not getting the checksum errors, this also appears to have fixed another problem I saw where executor would repeatedly ask my client (and possible the client would ask the executor - depending on the state at that moment) for resends. While debugging the checksum problem I found cases where the client, in attempting to honor the resend would throw an InvalidMessage due to a message gap in the FileStore e.g. the FileStore would have messages 5, 6, 7, 9, 10 as a "" string was being pushed onto the queue of messages to resend. Since applying the m_total = 0 fix, I've been able to down executor, bring it up and have it resync w/the client with none of the problems I've previously seen. Regards, Brendan |