save disabled booleans in comms state

I want them persisted since the GTK UI doesn't make sense and they
should effect background sends and receives too.
This commit is contained in:
Eric House 2017-05-26 07:30:42 -07:00
parent a815c466c9
commit 95ec573169
2 changed files with 17 additions and 2 deletions

View file

@ -160,8 +160,8 @@ struct CommsCtxt {
} rr;
XP_Bool isServer;
#ifdef DEBUG
XP_Bool disableds[COMMS_CONN_NTYPES][2];
#ifdef DEBUG
XP_Bool processingMsg;
const XP_UCHAR* tag;
#endif
@ -721,6 +721,14 @@ comms_makeFromStream( MPFORMAL XWStreamCtxt* stream, XW_UtilCtxt* util,
prevsQueueNext = &msg->next;
}
if ( STREAM_VERS_DISABLEDS <= version ) {
for ( int typ = 0; typ < VSIZE(comms->disableds); ++typ ) {
for ( int ii = 0; ii < VSIZE(comms->disableds[0]); ++ii ) {
comms->disableds[typ][ii] = 0 != stream_getBits( stream, 1 );
}
}
}
return comms;
} /* comms_makeFromStream */
@ -902,6 +910,12 @@ comms_writeToStream( CommsCtxt* comms, XWStreamCtxt* stream,
stream_putBytes( stream, msg->msg, msg->len );
}
for ( int typ = 0; typ < VSIZE(comms->disableds); ++typ ) {
for ( int ii = 0; ii < VSIZE(comms->disableds[0]); ++ii ) {
stream_putBits( stream, 1, comms->disableds[typ][ii] ? 1 : 0 );
}
}
comms->lastSaveToken = saveToken;
} /* comms_writeToStream */

View file

@ -47,6 +47,7 @@
#endif
#define MAX_COLS MAX_ROWS
#define STREAM_VERS_DISABLEDS 0x1A
#define STREAM_VERS_DEVIDS 0x19
#define STREAM_VERS_MULTIADDR 0x18
#define STREAM_VERS_MODELDIVIDER 0x17
@ -87,7 +88,7 @@
#define STREAM_VERS_405 0x01
/* search for FIX_NEXT_VERSION_CHANGE next time this is changed */
#define CUR_STREAM_VERS STREAM_VERS_DEVIDS
#define CUR_STREAM_VERS STREAM_VERS_DISABLEDS
typedef struct XP_Rect {
XP_S16 left;