client/List: use IntrusiveList instead of boost::intrusive::list
This commit is contained in:
parent
988f5d1b5d
commit
1da8faa285
@ -29,14 +29,13 @@
|
|||||||
#include "player/Control.hxx"
|
#include "player/Control.hxx"
|
||||||
#include "player/Listener.hxx"
|
#include "player/Listener.hxx"
|
||||||
#include "protocol/RangeArg.hxx"
|
#include "protocol/RangeArg.hxx"
|
||||||
|
#include "util/IntrusiveList.hxx"
|
||||||
#include "ReplayGainMode.hxx"
|
#include "ReplayGainMode.hxx"
|
||||||
#include "SingleMode.hxx"
|
#include "SingleMode.hxx"
|
||||||
#include "ConsumeMode.hxx"
|
#include "ConsumeMode.hxx"
|
||||||
#include "Chrono.hxx"
|
#include "Chrono.hxx"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <boost/intrusive/list.hpp>
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -47,6 +46,7 @@ class MultipleOutputs;
|
|||||||
class SongLoader;
|
class SongLoader;
|
||||||
class ClientListener;
|
class ClientListener;
|
||||||
class Client;
|
class Client;
|
||||||
|
struct ClientPerPartitionListHook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A partition of the Music Player Daemon. It is a separate unit with
|
* A partition of the Music Player Daemon. It is a separate unit with
|
||||||
@ -65,10 +65,7 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
|
|||||||
|
|
||||||
std::unique_ptr<ClientListener> listener;
|
std::unique_ptr<ClientListener> listener;
|
||||||
|
|
||||||
boost::intrusive::list<Client,
|
IntrusiveList<Client, ClientPerPartitionListHook, false> clients;
|
||||||
boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::tag<Partition>,
|
|
||||||
boost::intrusive::link_mode<boost::intrusive::normal_link>>>,
|
|
||||||
boost::intrusive::constant_time_size<false>> clients;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Monitor for idle events local to this partition.
|
* Monitor for idle events local to this partition.
|
||||||
|
@ -27,9 +27,7 @@
|
|||||||
#include "tag/Mask.hxx"
|
#include "tag/Mask.hxx"
|
||||||
#include "event/FullyBufferedSocket.hxx"
|
#include "event/FullyBufferedSocket.hxx"
|
||||||
#include "event/CoarseTimerEvent.hxx"
|
#include "event/CoarseTimerEvent.hxx"
|
||||||
|
#include "util/IntrusiveList.hxx"
|
||||||
#include <boost/intrusive/link_mode.hpp>
|
|
||||||
#include <boost/intrusive/list_hook.hpp>
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -50,10 +48,13 @@ class Storage;
|
|||||||
class BackgroundCommand;
|
class BackgroundCommand;
|
||||||
|
|
||||||
class Client final
|
class Client final
|
||||||
: FullyBufferedSocket,
|
: FullyBufferedSocket
|
||||||
public boost::intrusive::list_base_hook<boost::intrusive::tag<Partition>,
|
{
|
||||||
boost::intrusive::link_mode<boost::intrusive::normal_link>>,
|
friend struct ClientPerPartitionListHook;
|
||||||
public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
|
friend class ClientList;
|
||||||
|
|
||||||
|
IntrusiveListHook list_siblings, partition_siblings;
|
||||||
|
|
||||||
CoarseTimerEvent timeout_event;
|
CoarseTimerEvent timeout_event;
|
||||||
|
|
||||||
Partition *partition;
|
Partition *partition;
|
||||||
@ -295,6 +296,9 @@ private:
|
|||||||
void OnTimeout() noexcept;
|
void OnTimeout() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ClientPerPartitionListHook
|
||||||
|
: IntrusiveListMemberHookTraits<&Client::partition_siblings> {};
|
||||||
|
|
||||||
void
|
void
|
||||||
client_new(EventLoop &loop, Partition &partition,
|
client_new(EventLoop &loop, Partition &partition,
|
||||||
UniqueSocketDescriptor fd, SocketAddress address, int uid,
|
UniqueSocketDescriptor fd, SocketAddress address, int uid,
|
||||||
|
@ -21,13 +21,11 @@
|
|||||||
#define MPD_CLIENT_LIST_HXX
|
#define MPD_CLIENT_LIST_HXX
|
||||||
|
|
||||||
#include "Client.hxx"
|
#include "Client.hxx"
|
||||||
|
#include "util/IntrusiveList.hxx"
|
||||||
#include <boost/intrusive/list.hpp>
|
|
||||||
|
|
||||||
class ClientList {
|
class ClientList {
|
||||||
using List =
|
using List =
|
||||||
boost::intrusive::list<Client,
|
IntrusiveList<Client, IntrusiveListMemberHookTraits<&Client::list_siblings>, true>;
|
||||||
boost::intrusive::constant_time_size<true>>;
|
|
||||||
|
|
||||||
const unsigned max_size;
|
const unsigned max_size;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user