A lot of updates
This commit is contained in:
parent
a8843f5311
commit
04666982d9
@ -103,6 +103,7 @@ namespace ts {
|
|||||||
INIT_HIGH, //Web -> Auth
|
INIT_HIGH, //Web -> Auth
|
||||||
CONNECTED,
|
CONNECTED,
|
||||||
DISCONNECTING,
|
DISCONNECTING,
|
||||||
|
DISCONNECTING_FLUSHING,
|
||||||
DISCONNECTED
|
DISCONNECTED
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include "spdlog/fmt/ostr.h" // must be included
|
#include "spdlog/fmt/ostr.h" // must be included
|
||||||
|
|
||||||
#define permNotGranted (-2)
|
#define permNotGranted (-2)
|
||||||
#define PERM_ID_GRANT ((ts::permission::PermissionType) (1 << 15))
|
#define PERM_ID_GRANT ((ts::permission::PermissionType) (1U << 15U))
|
||||||
|
|
||||||
namespace ts {
|
namespace ts {
|
||||||
class BasicChannel;
|
class BasicChannel;
|
||||||
@ -36,6 +36,7 @@ namespace ts {
|
|||||||
|
|
||||||
permission_id_min = 0, /* we count unknown as defined permission as well */
|
permission_id_min = 0, /* we count unknown as defined permission as well */
|
||||||
unknown = (uint16_t) 0,
|
unknown = (uint16_t) 0,
|
||||||
|
ok = 0,
|
||||||
type_begin = 1,
|
type_begin = 1,
|
||||||
|
|
||||||
/* global */
|
/* global */
|
||||||
@ -887,12 +888,13 @@ namespace ts {
|
|||||||
static constexpr size_t PERMISSIONS_BULK_BLOCK_MASK = (~(1 << PERMISSIONS_BULK_BITS)) & ((1 << PERMISSIONS_BULK_BITS) - 1);
|
static constexpr size_t PERMISSIONS_BULK_BLOCK_MASK = (~(1 << PERMISSIONS_BULK_BITS)) & ((1 << PERMISSIONS_BULK_BITS) - 1);
|
||||||
|
|
||||||
bool requires_db_save = false;
|
bool requires_db_save = false;
|
||||||
ts_always_inline void trigger_db_update() { this->requires_db_save = true; } /* todo: pull some kind of trigger? */
|
ts_always_inline void trigger_db_update() { this->requires_db_save = true; }
|
||||||
|
|
||||||
spin_lock block_use_count_lock{};
|
spin_lock block_use_count_lock{};
|
||||||
int16_t block_use_count[BULK_COUNT];
|
int16_t block_use_count[BULK_COUNT];
|
||||||
PermissionContainerBulk<PERMISSIONS_BULK_ENTRY_COUNT>* block_containers[BULK_COUNT];
|
PermissionContainerBulk<PERMISSIONS_BULK_ENTRY_COUNT>* block_containers[BULK_COUNT];
|
||||||
|
|
||||||
|
//TODO: Bulk permissions for channels as well, specially because they're client permissions in terms of the music bot!
|
||||||
std::shared_mutex channel_list_lock{};
|
std::shared_mutex channel_list_lock{};
|
||||||
std::deque<std::unique_ptr<ChannelPermissionContainer>> _channel_permissions{};
|
std::deque<std::unique_ptr<ChannelPermissionContainer>> _channel_permissions{};
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ namespace ts {
|
|||||||
this->data_ptr->casted_value = ts::converter<T>::from_string_view(this->data_ptr->value);
|
this->data_ptr->casted_value = ts::converter<T>::from_string_view(this->data_ptr->value);
|
||||||
return std::any_cast<T>(this->data_ptr->casted_value);
|
return std::any_cast<T>(this->data_ptr->casted_value);
|
||||||
} catch(std::exception&) {
|
} catch(std::exception&) {
|
||||||
return 0;
|
return T{};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,24 +208,6 @@ namespace ts {
|
|||||||
public:
|
public:
|
||||||
std::recursive_timed_mutex buffer_lock;
|
std::recursive_timed_mutex buffer_lock;
|
||||||
std::recursive_timed_mutex execute_lock;
|
std::recursive_timed_mutex execute_lock;
|
||||||
|
|
||||||
inline uint16_t generation(uint16_t packet_id) {
|
|
||||||
size_t relative_index = 0;
|
|
||||||
if(!this->calculate_index(packet_id, relative_index))
|
|
||||||
relative_index = 0; /* okey we dont give a fuck */
|
|
||||||
|
|
||||||
return ((this->_ring_index_full + relative_index) >> 16) & 0xFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void set_generation(uint16_t value) {
|
|
||||||
this->_ring_index_full = (value << 16) | (this->_ring_index_full & 0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void set_generation_packet(uint16_t generation, uint16_t packet) {
|
|
||||||
this->_ring_index_full = (generation << 16) | (packet & 0xFFFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline uint64_t full_index() { return this->_ring_index_full; }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user