* Corrected client session handling to make internal IPC socket persistent
* Applies to cli/netconf/restconf/client-api code
* Previous behaviour:
* Close socket after each rpc, but now keeps the socket open until the client terminates
* Kept locks over socket life-cycle, but according to RFC 6241 7.5 a lock should be relaeased when session ends
This commit is contained in:
parent
b41f68b677
commit
f5f013c739
18 changed files with 371 additions and 145 deletions
|
|
@ -46,7 +46,7 @@ typedef void *clixon_client_handle;
|
|||
typedef enum {
|
||||
CLIXON_CLIENT_IPC, /* Internal IPC API, only experimental use */
|
||||
CLIXON_CLIENT_NETCONF, /* External Netconf */
|
||||
CLIXON_CLIENT_SSH /* External Netconf over SSH */
|
||||
CLIXON_CLIENT_SSH /* NYI External Netconf over SSH */
|
||||
} clixon_client_type;
|
||||
|
||||
/*
|
||||
|
|
@ -68,6 +68,9 @@ int clixon_client_get_uint16(clixon_client_handle ch, uint16_t *rval, const ch
|
|||
int clixon_client_get_uint32(clixon_client_handle ch, uint32_t *rval, const char *xnamespace, const char *xpath);
|
||||
int clixon_client_get_uint64(clixon_client_handle ch, uint64_t *rval, const char *xnamespace, const char *xpath);
|
||||
|
||||
/* Access functions */
|
||||
int clixon_client_socket_get(clixon_client_handle ch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -102,10 +102,14 @@ int clicon_username_set(clicon_handle h, void *username);
|
|||
enum startup_status clicon_startup_status_get(clicon_handle h);
|
||||
int clicon_startup_status_set(clicon_handle h, enum startup_status status);
|
||||
|
||||
/* Set and get socket fd (ie backend server socket / restconf fcgx socket */
|
||||
/* Set and get server socket fd (ie backend server socket / restconf fcgi socket */
|
||||
int clicon_socket_get(clicon_handle h);
|
||||
int clicon_socket_set(clicon_handle h, int s);
|
||||
|
||||
/* Set and get client socket fd (ie client cli / netconf / restconf / client-api socket */
|
||||
int clicon_client_socket_get(clicon_handle h);
|
||||
int clicon_client_socket_set(clicon_handle h, int s);
|
||||
|
||||
/*! Set and get module state full and brief cached tree */
|
||||
cxobj *clicon_modst_cache_get(clicon_handle h, int brief);
|
||||
int clicon_modst_cache_set(clicon_handle h, int brief, cxobj *xms);
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ static inline int clicon_cli_tab_mode(clicon_handle h){
|
|||
static inline char *clicon_cli_model_treename(clicon_handle h){
|
||||
return clicon_option_str(h, "CLICON_CLI_MODEL_TREENAME");
|
||||
}
|
||||
static inline char *clicon_sock(clicon_handle h){
|
||||
static inline char *clicon_sock_str(clicon_handle h){
|
||||
return clicon_option_str(h, "CLICON_SOCK");
|
||||
}
|
||||
static inline char *clicon_sock_group(clicon_handle h){
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ typedef int (proc_cb_t)(clicon_handle h, process_entry_t *pe, char **operation);
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int clixon_proc_socket(char **argv, pid_t *pid, int *fdin, int *fdout);
|
||||
int clixon_proc_socket_close(pid_t pid, int fdin, int fdout);
|
||||
int clixon_proc_socket(char **argv, pid_t *pid, int *sock);
|
||||
int clixon_proc_socket_close(pid_t pid, int sock);
|
||||
int clixon_proc_background(char **argv, const char *netns, pid_t *pid);
|
||||
int clixon_process_register(clicon_handle h, const char *name, const char *netns, proc_cb_t *callback, char **argv, int argc);
|
||||
int clixon_process_delete_all(clicon_handle h);
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ int clicon_rpc_connect_inet(clicon_handle h,
|
|||
uint16_t port,
|
||||
int *sock0);
|
||||
|
||||
int clicon_rpc(int fdin, int fdout, struct clicon_msg *msg, char **xret);
|
||||
int clicon_rpc(int sock, struct clicon_msg *msg, char **xret);
|
||||
|
||||
int clicon_rpc1(int fdin, int fdout, cbuf *msgin, cbuf *msgret);
|
||||
int clicon_rpc1(int sock, cbuf *msgin, cbuf *msgret);
|
||||
|
||||
int clicon_msg_send(int s, struct clicon_msg *msg);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue