@@ -1823,7 +1823,6 @@ nc_client_ch_add_bind_listen(const char *address, uint16_t port, const char *hos
18231823 client_opts .ch_binds [client_opts .ch_bind_count - 1 ].address = strdup (address );
18241824 client_opts .ch_binds [client_opts .ch_bind_count - 1 ].port = port ;
18251825 client_opts .ch_binds [client_opts .ch_bind_count - 1 ].sock = sock ;
1826- client_opts .ch_binds [client_opts .ch_bind_count - 1 ].pollin = 0 ;
18271826
18281827 return 0 ;
18291828}
@@ -1886,7 +1885,7 @@ nc_accept_callhome(int timeout, struct ly_ctx *ctx, struct nc_session **session)
18861885{
18871886 int ret , sock ;
18881887 char * host = NULL ;
1889- uint16_t port , idx ;
1888+ uint16_t port , bind_idx = 0 ;
18901889
18911890 NC_CHECK_ARG_RET (NULL , session , -1 );
18921891
@@ -1895,8 +1894,8 @@ nc_accept_callhome(int timeout, struct ly_ctx *ctx, struct nc_session **session)
18951894 return -1 ;
18961895 }
18971896
1898- ret = nc_sock_accept_binds ( NULL , client_opts .ch_binds , client_opts .ch_bind_count , & client_opts . ch_bind_lock , timeout ,
1899- & host , & port , & idx , & sock );
1897+ ret = nc_server_ch_accept_binds ( client_opts .ch_binds , client_opts .ch_bind_count , timeout ,
1898+ & host , & port , & bind_idx , & sock );
19001899 if (ret < 1 ) {
19011900 free (host );
19021901 return ret ;
@@ -1909,11 +1908,11 @@ nc_accept_callhome(int timeout, struct ly_ctx *ctx, struct nc_session **session)
19091908 return -1 ;
19101909 }
19111910
1912- if (client_opts .ch_binds_aux [idx ].ti == NC_TI_SSH ) {
1911+ if (client_opts .ch_binds_aux [bind_idx ].ti == NC_TI_SSH ) {
19131912 * session = nc_accept_callhome_ssh_sock (sock , host , port , ctx , NC_TRANSPORT_TIMEOUT );
1914- } else if (client_opts .ch_binds_aux [idx ].ti == NC_TI_TLS ) {
1913+ } else if (client_opts .ch_binds_aux [bind_idx ].ti == NC_TI_TLS ) {
19151914 * session = nc_accept_callhome_tls_sock (sock , host , port , ctx , NC_TRANSPORT_TIMEOUT ,
1916- client_opts .ch_binds_aux [idx ].hostname );
1915+ client_opts .ch_binds_aux [bind_idx ].hostname );
19171916 } else {
19181917 close (sock );
19191918 * session = NULL ;
@@ -1971,13 +1970,6 @@ nc_session_ntf_thread_running(const struct nc_session *session)
19711970API int
19721971nc_client_init (void )
19731972{
1974- int r ;
1975-
1976- if ((r = pthread_mutex_init (& client_opts .ch_bind_lock , NULL ))) {
1977- ERR (NULL , "%s: failed to init bind lock(%s)." , __func__ , strerror (r ));
1978- return -1 ;
1979- }
1980-
19811973#ifdef NC_ENABLED_SSH_TLS
19821974 if (nc_tls_backend_init_wrap ()) {
19831975 ERR (NULL , "%s: failed to init the SSL library backend." , __func__ );
@@ -1995,7 +1987,6 @@ nc_client_init(void)
19951987API void
19961988nc_client_destroy (void )
19971989{
1998- pthread_mutex_destroy (& client_opts .ch_bind_lock );
19991990 nc_client_set_schema_searchpath (NULL );
20001991 nc_client_unix_set_username (NULL );
20011992#ifdef NC_ENABLED_SSH_TLS
0 commit comments