Reece
3a76aa6d69
[*] Fixup IPCPipe.NT recycling, including proper disconnect acknowledgment and removal of atomic release hack [*] End of stream callback hack in Async.NT for IPC. net requires something else; this hack will do [*] Fix io spin: bShouldReadNext wasn't reset on end of frame
57 lines
1.7 KiB
C++
57 lines
1.7 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: IPCPipe.NT.hpp
|
|
Date: 2022-4-15
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include "IPC.hpp"
|
|
|
|
#include <Source/IO/IPC/IPCHandle.hpp>
|
|
|
|
namespace Aurora::IO::IPC
|
|
{
|
|
struct IPCHasConnectionEvent;
|
|
struct IPCHandle;
|
|
|
|
struct IPCPipeImpl : IPCPipe, Loop::LSHandle, AuEnableSharedFromThis<IPCPipeImpl>
|
|
{
|
|
IPCPipeImpl(HANDLE clientHandle, HANDLE serverHandle, const IPCHandle &handle);
|
|
~IPCPipeImpl();
|
|
|
|
PROXY_INTERNAL_INTERFACE_(LSHandle::)
|
|
|
|
virtual AuSPtr<IO::IAsyncTransaction> NewAsyncTransaction() override;
|
|
|
|
virtual AuSPtr<Loop::ILoopSource> AsReadChannelIsOpen() override;
|
|
virtual AuSPtr<Loop::ILoopSource> AsReadChannelHasData() override;
|
|
|
|
virtual bool Read(const Memory::MemoryViewStreamWrite &write, bool nonblocking) override;
|
|
virtual bool Write(const Memory::MemoryViewStreamRead &read) override;
|
|
virtual AuString ExportToString() override;
|
|
|
|
bool IsSignaled() override;
|
|
bool WaitOn(AuUInt32 timeout) override;
|
|
Loop::ELoopSource GetType() override;
|
|
|
|
HANDLE GetPipeHandle();
|
|
HANDLE GetConnectHandle();
|
|
|
|
void OnEndOfReadStream();
|
|
|
|
void TryConnect();
|
|
OVERLAPPED overlapped {};
|
|
|
|
AuSPtr<Loop::ILSEvent> hasClient_;
|
|
private:
|
|
HANDLE serverHandle_ {INVALID_HANDLE_VALUE};
|
|
HANDLE clientHandle_ {INVALID_HANDLE_VALUE};
|
|
IPCHandle ipcHandle_;
|
|
AuSPtr<IO::FS::FileHandle> fsHandle_;
|
|
AuSPtr<IO::FS::NtAsyncFileStream> fsStream_;
|
|
AuSPtr<IPCHasConnectionEvent> lshasConnection_;
|
|
bool bFirstTime {true};
|
|
};
|
|
} |