50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuNetSocketChannelOutput.hpp
|
|
Date: 2022-8-32
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
#include "AuNetWriteQueue.hpp"
|
|
|
|
namespace Aurora::IO::Net
|
|
{
|
|
struct SocketBase;
|
|
struct NtAsyncNetworkTransaction;
|
|
|
|
struct SocketChannelOutput : IAsyncFinishedSubscriber
|
|
{
|
|
SocketChannelOutput(SocketBase *pParent, const AuSPtr<IAsyncTransaction> &stream);
|
|
|
|
bool IsValid();
|
|
AuSPtr<IAsyncTransaction> ToWriteTransaction();
|
|
AuSPtr<Memory::ByteBuffer> AsWritableByteBuffer();
|
|
|
|
void ScheduleOutOfFrameWrite();
|
|
|
|
// Write outbound shit
|
|
void SchedWriteTick();
|
|
void SendIfData();
|
|
bool WriteTickLocked();
|
|
void WriteTick();
|
|
void OnEndOfReadTick();
|
|
|
|
void OnAsyncFileOpFinished(AuUInt64 offset, AuUInt32 length) override;
|
|
|
|
bool bShutdownOnComplete {};
|
|
|
|
AuByteBuffer &GetByteBuffer();
|
|
bool CanResize();
|
|
|
|
private:
|
|
friend struct SocketBase;
|
|
SocketBase * pParent_;
|
|
AuSPtr<IAsyncTransaction> pNetWriteTransaction_;
|
|
void * pOutSendPointer_ {};
|
|
AuByteBuffer outputBuffer_;
|
|
NetWriteQueue outputWriteQueue_;
|
|
AuThreadPrimitives::SpinLock lock_;
|
|
};
|
|
} |