FS-10167: Linux build updated and basic tests work as expected
This commit is contained in:
parent
fd3348cafc
commit
077fde224b
|
@ -1,23 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Shane Bryldt
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -64,7 +64,7 @@ KS_DECLARE(ks_status_t) blade_mastermgr_create(blade_mastermgr_t **bmmgrP, blade
|
|||
blade_mastermgr_t *bmmgr = NULL;
|
||||
|
||||
ks_assert(bmmgrP);
|
||||
|
||||
|
||||
ks_pool_open(&pool);
|
||||
ks_assert(pool);
|
||||
|
||||
|
@ -122,7 +122,7 @@ KS_DECLARE(ks_status_t) blade_mastermgr_purge(blade_mastermgr_t *bmmgr, const ch
|
|||
|
||||
if (blade_protocol_purge(bp, nodeid)) {
|
||||
if (!cleanup) ks_hash_create(&cleanup, KS_HASH_MODE_CASE_INSENSITIVE, KS_HASH_FLAG_RWLOCK | KS_HASH_FLAG_DUP_CHECK, bmmgr->pool);
|
||||
ks_hash_insert(cleanup, key, bp);
|
||||
ks_hash_insert(cleanup, (void *)key, bp);
|
||||
}
|
||||
}
|
||||
if (cleanup) {
|
||||
|
@ -133,7 +133,7 @@ KS_DECLARE(ks_status_t) blade_mastermgr_purge(blade_mastermgr_t *bmmgr, const ch
|
|||
ks_hash_this(it, (const void **)&key, NULL, (void **)&bp);
|
||||
|
||||
ks_log(KS_LOG_DEBUG, "Protocol Removed: %s\n", key);
|
||||
ks_hash_remove(bmmgr->protocols, key);
|
||||
ks_hash_remove(bmmgr->protocols, (void *)key);
|
||||
}
|
||||
ks_hash_destroy(&cleanup);
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ KS_DECLARE(ks_status_t) blade_mastermgr_channel_authorize(blade_mastermgr_t *bmm
|
|||
ret = KS_STATUS_NOT_FOUND;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
ret = blade_protocol_channel_authorize(bp, remove, channel, controller, target);
|
||||
|
||||
done:
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2017, Shane Bryldt
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
*
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
*
|
||||
* * Neither the name of the original author; nor the names of any contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
|
@ -94,7 +94,7 @@ KS_DECLARE(ks_status_t) blade_protocol_create(blade_protocol_t **bpP, ks_pool_t
|
|||
KS_DECLARE(ks_status_t) blade_protocol_destroy(blade_protocol_t **bpP)
|
||||
{
|
||||
blade_protocol_t *bp = NULL;
|
||||
|
||||
|
||||
ks_assert(bpP);
|
||||
ks_assert(*bpP);
|
||||
|
||||
|
@ -120,7 +120,7 @@ KS_DECLARE(ks_bool_t) blade_protocol_purge(blade_protocol_t *bp, const char *nod
|
|||
|
||||
ks_hash_this(it, (const void **)&key, NULL, (void **)&authorizations);
|
||||
|
||||
if (ks_hash_remove(authorizations, nodeid)) {
|
||||
if (ks_hash_remove(authorizations, (void *)nodeid)) {
|
||||
ks_log(KS_LOG_DEBUG, "Protocol Channel Authorization Removed: %s from %s@%s/%s\n", nodeid, bp->name, bp->realm, key);
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ KS_DECLARE(ks_status_t) blade_protocol_channel_add(blade_protocol_t *bp, const c
|
|||
|
||||
ks_hash_write_lock(bp->channels);
|
||||
|
||||
if (ks_hash_search(bp->channels, name, KS_UNLOCKED)) {
|
||||
if (ks_hash_search(bp->channels, (void *)name, KS_UNLOCKED)) {
|
||||
ret = KS_STATUS_DUPLICATE_OPERATION;
|
||||
goto done;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ KS_DECLARE(ks_bool_t) blade_protocol_channel_verify(blade_protocol_t *bp, const
|
|||
|
||||
// @todo verify controller, get ks_hash_t* value based on channel, add target to the channels hash
|
||||
authorizations = (ks_hash_t *)ks_hash_search(bp->channels, (void *)channel, KS_READLOCKED);
|
||||
if (authorizations) ret = ks_hash_search(authorizations, target, KS_UNLOCKED) != NULL;
|
||||
if (authorizations) ret = ks_hash_search(authorizations, (void *)target, KS_UNLOCKED) != NULL;
|
||||
ks_hash_read_unlock(bp->channels);
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -1079,7 +1079,7 @@ KS_DECLARE(ks_status_t) blade_handle_rpcexecute(blade_handle_t *bh, const char *
|
|||
ks_log(KS_LOG_DEBUG, "Session (%s) execute request started\n", blade_session_id_get(bs));
|
||||
|
||||
ret = blade_session_send(bs, req, callback, data);
|
||||
|
||||
|
||||
done:
|
||||
if (req) cJSON_Delete(req);
|
||||
if (bs) blade_session_read_unlock(bs);
|
||||
|
@ -1176,7 +1176,7 @@ ks_bool_t blade_rpcexecute_request_handler(blade_rpc_request_t *brpcreq, void *d
|
|||
blade_session_send(bs, res, NULL, NULL);
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
callback = blade_rpc_callback_get(brpc);
|
||||
if (callback) ret = callback(brpcreq, blade_rpc_data_get(brpc));
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ KS_DECLARE(ks_status_t) blade_handle_rpcsubscribe(blade_handle_t *bh, const char
|
|||
temp_data->channel_callback = channel_callback;
|
||||
temp_data->channel_data = channel_data;
|
||||
ks_pool_set_cleanup(pool, temp_data, NULL, blade_rpcsubscribe_data_cleanup);
|
||||
|
||||
|
||||
ret = blade_handle_rpcsubscribe_raw(bh, protocol, realm, subscribe_channels, unsubscribe_channels, localid, KS_FALSE, blade_rpcsubscribe_response_handler, temp_data);
|
||||
|
||||
ks_pool_free(bh->pool, &localid);
|
||||
|
@ -1590,7 +1590,6 @@ done:
|
|||
ks_bool_t blade_rpcsubscribe_response_handler(blade_rpc_response_t *brpcres, void *data)
|
||||
{
|
||||
ks_bool_t ret = KS_FALSE;
|
||||
blade_rpc_request_t *brpcreq = NULL;
|
||||
blade_handle_t *bh = NULL;
|
||||
blade_session_t *bs = NULL;
|
||||
blade_rpcsubscribe_data_t *temp_data = NULL;
|
||||
|
@ -1607,8 +1606,6 @@ ks_bool_t blade_rpcsubscribe_response_handler(blade_rpc_response_t *brpcres, voi
|
|||
ks_assert(brpcres);
|
||||
ks_assert(data);
|
||||
|
||||
brpcreq = blade_rpc_response_request_get(brpcres);
|
||||
|
||||
bh = blade_rpc_response_handle_get(brpcres);
|
||||
ks_assert(bh);
|
||||
|
||||
|
|
|
@ -406,7 +406,6 @@ void command_unsubscribe(blade_handle_t *bh, char *args)
|
|||
void command_leave(blade_handle_t *bh, char *args)
|
||||
{
|
||||
cJSON *params = NULL;
|
||||
cJSON *channels = NULL;
|
||||
|
||||
ks_assert(bh);
|
||||
ks_assert(args);
|
||||
|
|
|
@ -42,12 +42,9 @@ extern "C"
|
|||
|
||||
#include "ks_cJSON.h"
|
||||
#include "ks_cJSON_Utils.h"
|
||||
|
||||
|
||||
KS_DECLARE(cJSON *) cJSON_CreateStringPrintf(const char *fmt, ...);
|
||||
KS_DECLARE(const char *)cJSON_GetObjectCstr(const cJSON *object, const char *string);
|
||||
KS_DECLARE(cJSON *) cJSON_CreatePtr(uintptr_t pointer);
|
||||
KS_DECLARE(uintptr_t) cJSON_GetPtrValue(const cJSON *object);
|
||||
KS_DECLARE(uintptr_t) cJSON_GetObjectPtr(const cJSON *object, const char *string);
|
||||
|
||||
static inline cJSON *ks_json_add_child_obj(cJSON *json, const char *name, cJSON *obj)
|
||||
{
|
||||
|
|
|
@ -28,25 +28,6 @@ KS_DECLARE(const char *) cJSON_GetObjectCstr(const cJSON *object, const char *st
|
|||
return cj->valuestring;
|
||||
}
|
||||
|
||||
KS_DECLARE(cJSON *) cJSON_CreatePtr(uintptr_t pointer)
|
||||
{
|
||||
// @todo check for 32bit and use integer storage instead
|
||||
return cJSON_CreateStringPrintf("%p", (void *)pointer);
|
||||
}
|
||||
|
||||
KS_DECLARE(uintptr_t) cJSON_GetPtrValue(const cJSON *object)
|
||||
{
|
||||
// @todo check for 32bit and use integer storage instead
|
||||
void *pointer = NULL;
|
||||
if (object && object->type == cJSON_String) sscanf_s(object->valuestring, "%p", &pointer);
|
||||
return (uintptr_t)pointer;
|
||||
}
|
||||
|
||||
KS_DECLARE(uintptr_t) cJSON_GetObjectPtr(const cJSON *object, const char *string)
|
||||
{
|
||||
return cJSON_GetPtrValue(cJSON_GetObjectItem(object, string));
|
||||
}
|
||||
|
||||
/* For Emacs:
|
||||
* Local Variables:
|
||||
* mode:c
|
||||
|
|
Loading…
Reference in New Issue