[+] Connect/Disconnect callbacks
This commit is contained in:
parent
aa7591967a
commit
bb3a872b07
@ -123,7 +123,9 @@ AUI_INTERFACE(AuIRPCChannelCallbacks,
|
||||
|
||||
AUI_INTERFACE(AuIRPCServerCallbacks,
|
||||
AUI_METHOD(void, OnMessage, (AuSPtr<AuIRPCSession>, pClient,
|
||||
AuByteBuffer &, refReadOnly))
|
||||
AuByteBuffer &, refReadOnly)),
|
||||
AUI_METHOD(void, OnConnect, (AuSPtr<AuIRPCSession>, pClient)),
|
||||
AUI_METHOD(void, OnDisconnect, (AuSPtr<AuIRPCSession>, pClient))
|
||||
);
|
||||
|
||||
struct AuIRPCRequest
|
||||
|
@ -61,6 +61,14 @@ void AuRPCServerChannel::OnDisconnect(bool error)
|
||||
|
||||
void AuRPCServerChannel::RemoveFromParent()
|
||||
{
|
||||
if (auto pCallbacks = this->server_->pCallbacks)
|
||||
{
|
||||
if (!this->isTempChannel_)
|
||||
{
|
||||
pCallbacks->OnDisconnect(this->SharedFromThis());
|
||||
}
|
||||
}
|
||||
|
||||
if (auto pParent = this->server_)
|
||||
{
|
||||
AU_LOCK_GUARD(pParent->lock->AsWritable());
|
||||
@ -193,6 +201,11 @@ void AuRPCServerChannel::SendConnectOK()
|
||||
res->FinalizeWrite();
|
||||
|
||||
this->SendResponse(res);
|
||||
|
||||
if (auto pCallbacks = this->server_->pCallbacks)
|
||||
{
|
||||
pCallbacks->OnConnect(this->SharedFromThis());
|
||||
}
|
||||
}
|
||||
|
||||
void AuRPCServerChannel::SendToNewChannel()
|
||||
|
Loading…
Reference in New Issue
Block a user