|
|
|
@ -43,7 +43,7 @@ extern int __create_sys_msg(sxmsg_t **msg, char *uuid, chnl_t *ch,
|
|
|
|
|
|
|
|
|
|
static long __cmp_ulong(const void *a, const void *b)
|
|
|
|
|
{
|
|
|
|
|
return *(ulong_t *)a - *(ulong_t *)b;
|
|
|
|
|
return (long)(*(ulong_t *)a - *(ulong_t *)b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int __alloc_channel(ulong_t cid, conn_t *co, rpc_typed_list_t *rlist, chnl_t **channel)
|
|
|
|
@ -57,6 +57,8 @@ int __alloc_channel(ulong_t cid, conn_t *co, rpc_typed_list_t *rlist, chnl_t **c
|
|
|
|
|
else if(idx_allocator_init(idx_msg, MAX_MSGINDEX, 0)) goto __fin_enomem;
|
|
|
|
|
|
|
|
|
|
if(!ch || !msg_tree) {
|
|
|
|
|
__fun_up2:
|
|
|
|
|
idx_allocator_destroy(idx_msg);
|
|
|
|
|
__fin_enomem:
|
|
|
|
|
r = ENOMEM;
|
|
|
|
|
goto __fin_up;
|
|
|
|
@ -67,15 +69,16 @@ int __alloc_channel(ulong_t cid, conn_t *co, rpc_typed_list_t *rlist, chnl_t **c
|
|
|
|
|
ch->uuid = NULL;
|
|
|
|
|
usrtc_node_init(&ch->node, ch);
|
|
|
|
|
if(rlist) ch->rpc_list = rlist->rpc_list;
|
|
|
|
|
else ch->rpc_list = NULL;
|
|
|
|
|
/* init locks */
|
|
|
|
|
if(pthread_rwlock_init(&(ch->msglock), NULL)) {
|
|
|
|
|
r = ENOMEM;
|
|
|
|
|
goto __fin_up;
|
|
|
|
|
goto __fin_up2;
|
|
|
|
|
}
|
|
|
|
|
if(pthread_mutex_init(&(ch->oplock), NULL)) {
|
|
|
|
|
pthread_rwlock_destroy(&(ch->msglock));
|
|
|
|
|
r = ENOMEM;
|
|
|
|
|
goto __fin_up;
|
|
|
|
|
goto __fin_up2;
|
|
|
|
|
}
|
|
|
|
|
/* assign all the stuff */
|
|
|
|
|
ch->idx_msg = idx_msg;
|
|
|
|
|