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