55 lines
1.4 KiB
C++
55 lines
1.4 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 SocketChannelInput :
|
||
|
IIOBufferedStreamAvailable /*read/input stream*/,
|
||
|
IIOPipeEventListener, /*read/input stream*/
|
||
|
IAsyncFinishedSubscriber
|
||
|
{
|
||
|
SocketChannelInput(SocketBase *pParent, const AuSPtr<IAsyncTransaction> &asyncStream);
|
||
|
|
||
|
//
|
||
|
void WarmOnEstablish();
|
||
|
void OnEstablish();
|
||
|
void OnReadTick();
|
||
|
|
||
|
AuSPtr<Memory::ByteBuffer> AsReadableByteBuffer();
|
||
|
|
||
|
// pipe
|
||
|
bool OnDataAvailable(Memory::ByteBuffer &view) override;
|
||
|
|
||
|
// listener
|
||
|
void OnPipePartialEvent(AuUInt transferred) override;
|
||
|
void OnPipeSuccessEvent() override;
|
||
|
void OnPipeFailureEvent() override;
|
||
|
|
||
|
void OnAsyncFileOpFinished(AuUInt64 offset,
|
||
|
AuUInt32 length) override;
|
||
|
|
||
|
bool IsValid();
|
||
|
|
||
|
AuSPtr<IIOPipeWork> pNetReader;
|
||
|
AuSPtr<IAsyncTransaction> pNetReadTransaction;
|
||
|
|
||
|
private:
|
||
|
void IncrementWorker();
|
||
|
void DecrementWorker();
|
||
|
|
||
|
bool bDecrementedWorker_ {};
|
||
|
SocketBase *pParent_;
|
||
|
|
||
|
};
|
||
|
}
|