2022-08-28 19:02:06 +00:00
|
|
|
/***
|
|
|
|
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();
|
2022-11-18 04:15:05 +00:00
|
|
|
bool WriteTickLocked();
|
2022-08-28 19:02:06 +00:00
|
|
|
void WriteTick();
|
|
|
|
void OnEndOfReadTick();
|
|
|
|
|
|
|
|
void OnAsyncFileOpFinished(AuUInt64 offset, AuUInt32 length) override;
|
|
|
|
|
2022-11-18 04:15:05 +00:00
|
|
|
bool bShutdownOnComplete {};
|
2022-12-12 23:50:05 +00:00
|
|
|
|
|
|
|
AuByteBuffer &GetByteBuffer();
|
|
|
|
bool CanResize();
|
|
|
|
|
2022-08-28 19:02:06 +00:00
|
|
|
private:
|
2023-04-26 19:22:11 +00:00
|
|
|
friend struct SocketBase;
|
2022-08-28 19:02:06 +00:00
|
|
|
SocketBase * pParent_;
|
|
|
|
AuSPtr<IAsyncTransaction> pNetWriteTransaction_;
|
|
|
|
void * pOutSendPointer_ {};
|
|
|
|
AuByteBuffer outputBuffer_;
|
|
|
|
NetWriteQueue outputWriteQueue_;
|
|
|
|
AuThreadPrimitives::SpinLock lock_;
|
|
|
|
};
|
|
|
|
}
|