Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ endif()
# Generic version of not only the library. Major version is reserved for really big changes of the project,
# minor version changes with added functionality (new tool, functionality of the tool or library, ...) and
# micro version is changed with a set of small changes or bugfixes anywhere in the project.
set(NP2SRV_VERSION 2.8.16)
set(NP2SRV_VERSION 2.8.17)

# libyang required version
set(LIBYANG_DEP_VERSION 6.3.0)
set(LIBYANG_DEP_SOVERSION 5.9.2)
set(LIBYANG_DEP_SOVERSION_MAJOR 5)

# libnetconf2 required version
set(LIBNETCONF2_DEP_VERSION 4.4.3)
set(LIBNETCONF2_DEP_SOVERSION 5.4.3)
set(LIBNETCONF2_DEP_VERSION 4.6.0)
set(LIBNETCONF2_DEP_SOVERSION 5.4.19)
set(LIBNETCONF2_DEP_SOVERSION_MAJOR 5)

# sysrepo required version
Expand Down Expand Up @@ -156,26 +156,13 @@ if(PkgConfig_FOUND)
pkg_check_modules(PKG_LN2 libnetconf2)

if(PKG_LN2_FOUND)
# libnetconf2 thread count check
pkg_get_variable(LN2_THREAD_COUNT libnetconf2 "LN2_MAX_THREAD_COUNT")
if(LN2_THREAD_COUNT)
if(LN2_THREAD_COUNT LESS THREAD_COUNT)
message(FATAL_ERROR "libnetconf2 was compiled with support up to ${LN2_THREAD_COUNT} threads, server is configured with ${THREAD_COUNT}.")
else()
message(STATUS "libnetconf2 was compiled with support of up to ${LN2_THREAD_COUNT} threads")
endif()
endif()

# get libnetconf2 module directory, use it later when installing modules
pkg_get_variable(LN2_YANG_MODULE_DIR libnetconf2 "LN2_SCHEMAS_DIR")
endif()
endif()

# } PKGCONFIG

if(NOT LN2_THREAD_COUNT)
message(STATUS "Unable to learn libnetconf2 thread support, check skipped")
endif()
if(NOT LN2_YANG_MODULE_DIR)
message(FATAL_ERROR "Unable to learn libnetconf2 module search directory, define LN2_YANG_MODULE_DIR manually.")
endif()
Expand Down
9 changes: 5 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,16 @@ signal_handler(int sig)
* @brief Callback for deleting NC sessions.
*
* @param[in] session NC session to delete.
* @param[in] in_ps Whether @p session is still in the pollsession.
*/
static void
np2srv_del_session_cb(struct nc_session *session)
np2srv_del_session_cb(struct nc_session *session, int in_ps)
{
struct np_user_sess *user_sess;
uint32_t i;

/* remove from PS structure */
if (nc_ps_del_session(np2srv.nc_ps, session)) {
if (in_ps && nc_ps_del_session(np2srv.nc_ps, session)) {
ERR("Removing session from ps failed.");
}

Expand Down Expand Up @@ -1115,7 +1116,7 @@ server_destroy(void)
while (nc_ps_session_count(np2srv.nc_ps)) {
sess = nc_ps_get_session(np2srv.nc_ps, 0);
nc_session_set_term_reason(sess, NC_SESSION_TERM_OTHER);
np2srv_del_session_cb(sess);
np2srv_del_session_cb(sess, 1);
sr_release_context(np2srv.sr_conn);
}
nc_ps_free(np2srv.nc_ps);
Expand Down Expand Up @@ -1554,7 +1555,7 @@ worker_thread(void *arg)
}
if (rc & NC_PSPOLL_SESSION_TERM) {
VRB("Session %d: thread %d event session terminated.", nc_session_get_id(ncs), idx);
np2srv_del_session_cb(ncs);
np2srv_del_session_cb(ncs, 0);
sr_release_context(np2srv.sr_conn);
}
#ifdef NC_ENABLED_SSH_TLS
Expand Down