Save important parts of save first.

This might reduce the likelyness of broken saves.
This commit is contained in:
irungentoo 2015-07-23 23:33:54 -04:00
parent 1de2ef78cf
commit efcb66ab1a
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98

View File

@ -2584,12 +2584,6 @@ void messenger_save(const Messenger *m, uint8_t *data)
save_keys(m->net_crypto, data + size32);
data += len;
len = DHT_size(m->dht);
type = MESSENGER_STATE_TYPE_DHT;
data = z_state_save_subheader(data, len, type);
DHT_save(m->dht, data);
data += len;
len = saved_friendslist_size(m);
type = MESSENGER_STATE_TYPE_FRIENDS;
data = z_state_save_subheader(data, len, type);
@ -2614,6 +2608,12 @@ void messenger_save(const Messenger *m, uint8_t *data)
*data = m->userstatus;
data += len;
len = DHT_size(m->dht);
type = MESSENGER_STATE_TYPE_DHT;
data = z_state_save_subheader(data, len, type);
DHT_save(m->dht, data);
data += len;
Node_format relays[NUM_SAVED_TCP_RELAYS];
type = MESSENGER_STATE_TYPE_TCP_RELAY;
uint8_t *temp_data = data;