mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-11-29 07:46:52 +01:00
commit newest tfs branch only for compare
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Tibia GIMUD Server - a free and open-source MMORPG server emulator
|
||||
* Copyright (C) 2019 Sabrehaven and Mark Samman <mark.samman@gmail.com>
|
||||
* The Forgotten Server - a free and open-source MMORPG server emulator
|
||||
* Copyright (C) 2019 Mark Samman <mark.samman@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -29,14 +29,6 @@ extern Scheduler g_scheduler;
|
||||
const uint16_t OUTPUTMESSAGE_FREE_LIST_CAPACITY = 2048;
|
||||
const std::chrono::milliseconds OUTPUTMESSAGE_AUTOSEND_DELAY {10};
|
||||
|
||||
class OutputMessageAllocator
|
||||
{
|
||||
public:
|
||||
typedef OutputMessage value_type;
|
||||
template<typename U>
|
||||
struct rebind {typedef LockfreePoolingAllocator<U, OUTPUTMESSAGE_FREE_LIST_CAPACITY> other;};
|
||||
};
|
||||
|
||||
void OutputMessagePool::scheduleSendAll()
|
||||
{
|
||||
auto functor = std::bind(&OutputMessagePool::sendAll, this);
|
||||
@@ -79,5 +71,7 @@ void OutputMessagePool::removeProtocolFromAutosend(const Protocol_ptr& protocol)
|
||||
|
||||
OutputMessage_ptr OutputMessagePool::getOutputMessage()
|
||||
{
|
||||
return std::allocate_shared<OutputMessage>(OutputMessageAllocator());
|
||||
// LockfreePoolingAllocator<void,...> will leave (void* allocate) ill-formed because
|
||||
// of sizeof(T), so this guaranatees that only one list will be initialized
|
||||
return std::allocate_shared<OutputMessage>(LockfreePoolingAllocator<void, OUTPUTMESSAGE_FREE_LIST_CAPACITY>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user