mirror of
https://github.com/RGBCube/serenity
synced 2026-01-14 06:01:00 +00:00
The DownloadFinished message from the server now includes a buffer ID that can be mapped into the client program. To avoid prematurely destroying the buffer, the server will hang on to it until the client lets it know that they're all good. That's what the ProtocolServer::DisownSharedBuffer message is about. In the future it would be nice if the kernel had a mechanism to allow passing ownership of a shared buffer along with an IPC message somehow.
30 lines
1.2 KiB
C++
30 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <AK/Badge.h>
|
|
#include <LibCore/CoreIPCServer.h>
|
|
#include <ProtocolServer/ProtocolServerEndpoint.h>
|
|
|
|
class Download;
|
|
class SharedBuffer;
|
|
|
|
class PSClientConnection final : public IPC::Server::ConnectionNG<ProtocolServerEndpoint>
|
|
, public ProtocolServerEndpoint {
|
|
C_OBJECT(PSClientConnection)
|
|
public:
|
|
explicit PSClientConnection(CLocalSocket&, int client_id);
|
|
~PSClientConnection() override;
|
|
|
|
virtual void die() override;
|
|
|
|
void did_finish_download(Badge<Download>, Download&, bool success);
|
|
void did_progress_download(Badge<Download>, Download&);
|
|
|
|
private:
|
|
virtual OwnPtr<ProtocolServer::GreetResponse> handle(const ProtocolServer::Greet&) override;
|
|
virtual OwnPtr<ProtocolServer::IsSupportedProtocolResponse> handle(const ProtocolServer::IsSupportedProtocol&) override;
|
|
virtual OwnPtr<ProtocolServer::StartDownloadResponse> handle(const ProtocolServer::StartDownload&) override;
|
|
virtual OwnPtr<ProtocolServer::StopDownloadResponse> handle(const ProtocolServer::StopDownload&) override;
|
|
virtual OwnPtr<ProtocolServer::DisownSharedBufferResponse> handle(const ProtocolServer::DisownSharedBuffer&) override;
|
|
|
|
HashMap<i32, RefPtr<SharedBuffer>> m_shared_buffers;
|
|
};
|