Client: convert partition to pointer
Prepare to make it mutable.
This commit is contained in:
parent
c7396b0675
commit
3eee35e1f7
@ -28,19 +28,19 @@ const Domain client_domain("client");
|
|||||||
Instance &
|
Instance &
|
||||||
Client::GetInstance()
|
Client::GetInstance()
|
||||||
{
|
{
|
||||||
return partition.instance;
|
return partition->instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
playlist &
|
playlist &
|
||||||
Client::GetPlaylist()
|
Client::GetPlaylist()
|
||||||
{
|
{
|
||||||
return partition.playlist;
|
return partition->playlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerControl &
|
PlayerControl &
|
||||||
Client::GetPlayerControl()
|
Client::GetPlayerControl()
|
||||||
{
|
{
|
||||||
return partition.pc;
|
return partition->pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_DATABASE
|
#ifdef ENABLE_DATABASE
|
||||||
@ -48,19 +48,19 @@ Client::GetPlayerControl()
|
|||||||
const Database *
|
const Database *
|
||||||
Client::GetDatabase() const
|
Client::GetDatabase() const
|
||||||
{
|
{
|
||||||
return partition.instance.GetDatabase();
|
return partition->instance.GetDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Database &
|
const Database &
|
||||||
Client::GetDatabaseOrThrow() const
|
Client::GetDatabaseOrThrow() const
|
||||||
{
|
{
|
||||||
return partition.instance.GetDatabaseOrThrow();
|
return partition->instance.GetDatabaseOrThrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Storage *
|
const Storage *
|
||||||
Client::GetStorage() const
|
Client::GetStorage() const
|
||||||
{
|
{
|
||||||
return partition.instance.storage;
|
return partition->instance.storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,7 +50,7 @@ class Storage;
|
|||||||
class Client final
|
class Client final
|
||||||
: FullyBufferedSocket, TimeoutMonitor,
|
: FullyBufferedSocket, TimeoutMonitor,
|
||||||
public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
|
public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
|
||||||
Partition &partition;
|
Partition *partition;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
unsigned permission;
|
unsigned permission;
|
||||||
@ -189,7 +189,7 @@ public:
|
|||||||
void AllowFile(Path path_fs) const;
|
void AllowFile(Path path_fs) const;
|
||||||
|
|
||||||
Partition &GetPartition() {
|
Partition &GetPartition() {
|
||||||
return partition;
|
return *partition;
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
|
@ -45,7 +45,7 @@ Client::Client(EventLoop &_loop, Partition &_partition,
|
|||||||
int _fd, int _uid, int _num)
|
int _fd, int _uid, int _num)
|
||||||
:FullyBufferedSocket(_fd, _loop, 16384, client_max_output_buffer_size),
|
:FullyBufferedSocket(_fd, _loop, 16384, client_max_output_buffer_size),
|
||||||
TimeoutMonitor(_loop),
|
TimeoutMonitor(_loop),
|
||||||
partition(_partition),
|
partition(&_partition),
|
||||||
permission(getDefaultPermissions()),
|
permission(getDefaultPermissions()),
|
||||||
uid(_uid),
|
uid(_uid),
|
||||||
num(_num),
|
num(_num),
|
||||||
@ -107,7 +107,7 @@ client_new(EventLoop &loop, Partition &partition,
|
|||||||
void
|
void
|
||||||
Client::Close()
|
Client::Close()
|
||||||
{
|
{
|
||||||
partition.instance.client_list->Remove(*this);
|
partition->instance.client_list->Remove(*this);
|
||||||
|
|
||||||
SetExpired();
|
SetExpired();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ Client::OnSocketInput(void *data, size_t length)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CommandResult::KILL:
|
case CommandResult::KILL:
|
||||||
partition.instance.Shutdown();
|
partition->instance.Shutdown();
|
||||||
Close();
|
Close();
|
||||||
return InputResult::CLOSED;
|
return InputResult::CLOSED;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Client::Subscribe(const char *channel)
|
|||||||
|
|
||||||
++num_subscriptions;
|
++num_subscriptions;
|
||||||
|
|
||||||
partition.EmitIdle(IDLE_SUBSCRIPTION);
|
partition->EmitIdle(IDLE_SUBSCRIPTION);
|
||||||
|
|
||||||
return Client::SubscribeResult::OK;
|
return Client::SubscribeResult::OK;
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ Client::Unsubscribe(const char *channel)
|
|||||||
subscriptions.erase(i);
|
subscriptions.erase(i);
|
||||||
--num_subscriptions;
|
--num_subscriptions;
|
||||||
|
|
||||||
partition.EmitIdle(IDLE_SUBSCRIPTION);
|
partition->EmitIdle(IDLE_SUBSCRIPTION);
|
||||||
|
|
||||||
assert((num_subscriptions == 0) ==
|
assert((num_subscriptions == 0) ==
|
||||||
subscriptions.empty());
|
subscriptions.empty());
|
||||||
|
Loading…
Reference in New Issue
Block a user