FD_CLR(client->cmd_socket, &imask);
FD_CLR(client->cmd_socket, &emask);
}
- bp_client_free(client);
- slot->client = NULL;
+ bp_remove_client_from_slot(slot);
return 0;
}
#endif
client->cmd_socket);
if (client->cmd_socket >= 0)
FD_CLR(client->cmd_socket, &listen_fdset);
- bp_client_free(client);
- privates->slots[oldest_index].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[oldest_index]);
i = oldest_index;
} else {
TRACE_ERROR("[CRITICAL] No space in slots");
TRACE_ERROR("client type");
bp_ipc_send_errorcode(clientfd,
BP_ERROR_PERMISSION_DENY);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
} else if (!strcmp(privates->slots[i].client->privilege_label, "inhouse")) {
// inhouse APIs (tab & scrap) have no privilege label.
TRACE_ERROR("failed to create cynara client identification string");
bp_ipc_send_errorcode(clientfd,
BP_ERROR_PERMISSION_DENY);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
if(cynara_creds_socket_get_user(clientfd, USER_METHOD_UID,
TRACE_ERROR("failed to create cynara user identification string");
bp_ipc_send_errorcode(clientfd,
BP_ERROR_PERMISSION_DENY);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
pid_t cynara_pid;
TRACE_ERROR("failed to create PID string for client session");
bp_ipc_send_errorcode(clientfd,
BP_ERROR_PERMISSION_DENY);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
if((privates->slots[i].client->cynara_session = cynara_session_from_pid(cynara_pid)) == NULL) {
TRACE_ERROR("failed to create client session");
bp_ipc_send_errorcode(clientfd,
BP_ERROR_PERMISSION_DENY);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
TRACE_ERROR("client have no privilege permission");
bp_ipc_send_errorcode(clientfd,
BP_ERROR_PERMISSION_DENY);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
#endif
if (privates->slots[i].client->notify < 0) {
TRACE_ERROR("failed to open fifo slot:%d", clientfd);
bp_ipc_send_errorcode(clientfd, BP_ERROR_IO_ERROR);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
TRACE_ERROR("[ERROR][main_thread] create\n");
bp_ipc_send_errorcode(clientfd,
BP_ERROR_OUT_OF_MEMORY);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
pthread_detach(privates->slots[i].client->tid);
continue;
if (privates->slots[i].client->cmd_socket < 0){
TRACE_ERROR("[CRITICAL] [i] Found Bad socket", i);
- bp_client_free(privates->slots[i].client);
- privates->slots[i].client = NULL;
+ bp_remove_client_from_slot(&privates->slots[i]);
continue;
}
if (__handle_client_request
(privates->slots[i].client) == BP_ERROR_IO_ERROR) {
TRACE_ERROR("disconnect client slot:%d sock:%d", i,
- client->cmd_socket);
- FD_CLR(client->cmd_socket, &listen_fdset);
- bp_client_free(client);
- privates->slots[i].client = NULL;
+ privates->slots[i].client->cmd_socket);
+ FD_CLR(privates->slots[i].client->cmd_socket, &listen_fdset);
+ bp_remove_client_from_slot(&privates->slots[i]);
}
} // FD_ISSET
} // BP_MAX_CLIENT