Skip to content

Commit f635a21

Browse files
committed
fix(network): cleanup the network configuration during network logout
1 parent 2200655 commit f635a21

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

src/network.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,21 +682,24 @@ void cloudsync_network_init (sqlite3_context *context, int argc, sqlite3_value *
682682
network_data_free(netdata);
683683
}
684684

685-
void cloudsync_network_cleanup (sqlite3_context *context, int argc, sqlite3_value **argv) {
686-
DEBUG_FUNCTION("cloudsync_network_cleanup");
687-
685+
void cloudsync_network_cleanup_internal (sqlite3_context *context) {
688686
cloudsync_context *data = (cloudsync_context *)sqlite3_user_data(context);
689687
network_data *netdata = cloudsync_network_data(context);
690688
cloudsync_set_auxdata(data, NULL);
691689
network_data_free(netdata);
692-
693-
sqlite3_result_int(context, SQLITE_OK);
694690

695691
#ifndef CLOUDSYNC_OMIT_CURL
696692
curl_global_cleanup();
697693
#endif
698694
}
699695

696+
void cloudsync_network_cleanup (sqlite3_context *context, int argc, sqlite3_value **argv) {
697+
DEBUG_FUNCTION("cloudsync_network_cleanup");
698+
699+
cloudsync_network_cleanup_internal(context);
700+
sqlite3_result_int(context, SQLITE_OK);
701+
}
702+
700703
// MARK: - Public -
701704

702705
bool cloudsync_network_set_authentication_token (sqlite3_context *context, const char *value, bool is_token) {
@@ -983,6 +986,7 @@ void cloudsync_network_logout (sqlite3_context *context, int argc, sqlite3_value
983986
finalize:
984987
if (completed) {
985988
database_commit_savepoint(data, "cloudsync_logout_savepoint");
989+
cloudsync_network_cleanup_internal(context);
986990
sqlite3_result_int(context, SQLITE_OK);
987991
} else {
988992
// cleanup:

0 commit comments

Comments
 (0)