Successfully synchronizes state. Here testing with 50% bidi packet loss.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <endian.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "networktransport.hpp"
|
||||
|
||||
@@ -17,7 +18,21 @@ string Instruction::tostring( void )
|
||||
ret += network_order_string( old_num );
|
||||
ret += network_order_string( new_num );
|
||||
ret += network_order_string( ack_num );
|
||||
ret += network_order_string( throwaway_num );
|
||||
ret += diff;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Instruction::Instruction( string &x )
|
||||
: old_num( -1 ), new_num( -1 ), ack_num( -1 ), throwaway_num( -1 ), diff()
|
||||
{
|
||||
assert( x.size() >= 4 * sizeof( uint64_t ) );
|
||||
uint64_t *data = (uint64_t *)x.data();
|
||||
old_num = be64toh( data[ 0 ] );
|
||||
new_num = be64toh( data[ 1 ] );
|
||||
ack_num = be64toh( data[ 2 ] );
|
||||
throwaway_num = be64toh( data[ 3 ] );
|
||||
|
||||
diff = string( x.begin() + 4 * sizeof( uint64_t ), x.end() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user