Skip to content

Commit a9e9d45

Browse files
committed
session client UPDATE compile all modules together
To avoid false-positive warnings or errors. Fixes CESNET/libyang#1837
1 parent 500cf4b commit a9e9d45

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/session_client.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,11 +1227,20 @@ nc_ctx_check_and_fill(struct nc_session *session)
12271227
}
12281228
}
12291229

1230+
/* compile all modules at once to avoid invalid errors or warnings */
1231+
ly_ctx_set_options(session->ctx, LY_CTX_EXPLICIT_COMPILE);
1232+
1233+
/* fill the context */
12301234
if (nc_ctx_fill(session, server_modules, old_clb, old_data, get_schema_support)) {
12311235
goto cleanup;
12321236
}
12331237

1234-
/* succsess */
1238+
/* compile it */
1239+
if (ly_ctx_compile(session->ctx)) {
1240+
goto cleanup;
1241+
}
1242+
1243+
/* success */
12351244
ret = 0;
12361245

12371246
if (session->flags & NC_SESSION_CLIENT_NOT_STRICT) {
@@ -1245,6 +1254,7 @@ nc_ctx_check_and_fill(struct nc_session *session)
12451254
/* set user callback back */
12461255
ly_ctx_set_module_imp_clb(session->ctx, old_clb, old_data);
12471256
ly_ctx_unset_options(session->ctx, LY_CTX_DISABLE_SEARCHDIRS);
1257+
ly_ctx_unset_options(session->ctx, LY_CTX_EXPLICIT_COMPILE);
12481258

12491259
return ret;
12501260
}

src/session_server.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3461,7 +3461,6 @@ nc_server_ch_client_thread_session_cond_wait(struct nc_session *session, struct
34613461
/* CH UNLOCK */
34623462
pthread_mutex_unlock(&session->opts.server.ch_lock);
34633463

3464-
release_ctx:
34653464
/* session terminated, release its context */
34663465
data->release_ctx_cb(data->ctx_cb_data);
34673466

0 commit comments

Comments
 (0)