[+] Linux datagrams
[+] NetSocketBind::uDefaultInputStreamSize [+] NetDatagramBind::uDefaultInputStreamSize
This commit is contained in:
parent
42d02b185c
commit
1e4082c02f
@ -16,6 +16,7 @@ namespace Aurora::IO::Net
|
|||||||
{
|
{
|
||||||
IPAddress ip;
|
IPAddress ip;
|
||||||
AuUInt16 uPort;
|
AuUInt16 uPort;
|
||||||
|
AuUInt32 uDefaultInputStreamSize;
|
||||||
AuSPtr<IDatagramDriver> pDriver;
|
AuSPtr<IDatagramDriver> pDriver;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,8 +34,9 @@ namespace Aurora::IO::Net
|
|||||||
AuUInt16 uPort {};
|
AuUInt16 uPort {};
|
||||||
AuSPtr<ISocketDriverFactory> pFactory;
|
AuSPtr<ISocketDriverFactory> pFactory;
|
||||||
AuSPtr<ISocketServerDriver> pDriver;
|
AuSPtr<ISocketServerDriver> pDriver;
|
||||||
AuUInt uMaxConnections {};
|
AuUInt32 uMaxConnections {};
|
||||||
AuUInt uMaxAcceptBacklog {};
|
AuUInt32 uMaxAcceptBacklog {};
|
||||||
|
AuUInt32 uDefaultInputStreamSize /* also: abs max datagram size of datagrams over sockets. note that each sessions buffer could be raised if tick/fragement future-buffering rejection. */ {};
|
||||||
bool bMultiThreaded {};
|
bool bMultiThreaded {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,15 +13,18 @@ namespace Aurora::IO::Net
|
|||||||
{
|
{
|
||||||
DatagramServerImpl::DatagramServerImpl(NetInterface *pInterface,
|
DatagramServerImpl::DatagramServerImpl(NetInterface *pInterface,
|
||||||
NetWorker *pWorker,
|
NetWorker *pWorker,
|
||||||
const AuSPtr<IDatagramDriver> &pDriver) :
|
const AuSPtr<IDatagramDriver> &pDriver,
|
||||||
|
AuUInt32 uDefaultPacketSize) :
|
||||||
DatagramServer(pInterface,
|
DatagramServer(pInterface,
|
||||||
pWorker,
|
pWorker,
|
||||||
pDriver),
|
pDriver,
|
||||||
SocketServerImpl(pInterface,
|
uDefaultPacketSize),
|
||||||
pWorker,
|
SocketServerImpl(pInterface, // struct NetInterface *pInterface
|
||||||
{},
|
pWorker, // struct NetWorker *pWorker
|
||||||
{},
|
{}, // const AuSPtr<ISocketServerDriver> &pDriver
|
||||||
4096,
|
{}, // const AuSPtr<ISocketDriverFactory> &pFactory
|
||||||
|
4096, // uMaxConnections
|
||||||
|
uDefaultPacketSize, // uDefaultInputStreamSize
|
||||||
true),
|
true),
|
||||||
Socket(pInterface, pWorker, {}, -1)
|
Socket(pInterface, pWorker, {}, -1)
|
||||||
{
|
{
|
||||||
|
@ -13,22 +13,82 @@ namespace Aurora::IO::Net
|
|||||||
{
|
{
|
||||||
DatagramServerImpl::DatagramServerImpl(NetInterface *pInterface,
|
DatagramServerImpl::DatagramServerImpl(NetInterface *pInterface,
|
||||||
NetWorker *pWorker,
|
NetWorker *pWorker,
|
||||||
const AuSPtr<IDatagramDriver> &pDriver) :
|
const AuSPtr<IDatagramDriver> &pDriver,
|
||||||
|
AuUInt32 uDefaultPacketSize) :
|
||||||
DatagramServer(pInterface,
|
DatagramServer(pInterface,
|
||||||
pWorker,
|
pWorker,
|
||||||
pDriver),
|
pDriver,
|
||||||
SocketServerImpl(pInterface,
|
uDefaultPacketSize),
|
||||||
pWorker,
|
SocketServerImpl(pInterface, // struct NetInterface *pInterface
|
||||||
{},
|
pWorker, // struct NetWorker *pWorker
|
||||||
{},
|
{}, // const AuSPtr<ISocketServerDriver> &pDriver
|
||||||
4096,
|
{}, // const AuSPtr<ISocketDriverFactory> &pFactory
|
||||||
true),
|
4096, // uMaxConnections
|
||||||
|
uDefaultPacketSize, // uDefaultInputStreamSize
|
||||||
|
true), // bMultiThreaded
|
||||||
Socket(pInterface, pWorker, {}, -1)
|
Socket(pInterface, pWorker, {}, -1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DatagramServerImpl::DoPosixTick()
|
void DatagramServerImpl::DoPosixTick()
|
||||||
{
|
{
|
||||||
// We dont use this tick under NT
|
do
|
||||||
|
{
|
||||||
|
auto uLength = this->uDefaultInputStreamSize ? this->uDefaultInputStreamSize : kDefaultStreamSize;
|
||||||
|
auto pBuffer = AuMakeShared<AuByteBuffer>(uLength);
|
||||||
|
if (!pBuffer)
|
||||||
|
{
|
||||||
|
SysPushErrorMemory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pBuffer->IsValid())
|
||||||
|
{
|
||||||
|
SysPushErrorMemory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NetEndpoint endpoint;
|
||||||
|
|
||||||
|
socklen_t addressLength { sizeof(sockaddr_storage) };
|
||||||
|
auto sRet = ::recvfrom(this->ToPlatformHandle(), pBuffer->writePtr, uLength, MSG_DONTWAIT, (struct sockaddr *)endpoint.hint, &addressLength);
|
||||||
|
if (sRet <= 0)
|
||||||
|
{
|
||||||
|
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SysPushErrorNet("recvfrom: {}", sRet);
|
||||||
|
// TODO: report and teardown if critical
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pBuffer->writePtr += sRet;
|
||||||
|
|
||||||
|
DeoptimizeEndpoint(endpoint);
|
||||||
|
endpoint.transportProtocol = ETransportProtocol::eProtocolUDP;
|
||||||
|
|
||||||
|
if (this->pDriver_)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this->pDriver_->OnPacket(endpoint, pBuffer);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
SysPushErrorCatch();
|
||||||
|
|
||||||
|
if (this->pDriver_)
|
||||||
|
{
|
||||||
|
this->pDriver_->OnError(AuNet::NetError(ENetworkError::eCatchException));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
while (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,11 +9,12 @@
|
|||||||
|
|
||||||
namespace Aurora::IO::Net
|
namespace Aurora::IO::Net
|
||||||
{
|
{
|
||||||
struct DatagramServerImpl : virtual DatagramServer
|
struct DatagramServerImpl : DatagramServer
|
||||||
{
|
{
|
||||||
DatagramServerImpl(struct NetInterface *pInterface,
|
DatagramServerImpl(struct NetInterface *pInterface,
|
||||||
struct NetWorker *pWorker,
|
struct NetWorker *pWorker,
|
||||||
const AuSPtr<IDatagramDriver> &pDriver);
|
const AuSPtr<IDatagramDriver> &pDriver,
|
||||||
|
AuUInt32 uDefaultPacketSize);
|
||||||
|
|
||||||
void DoPosixTick() override;
|
void DoPosixTick() override;
|
||||||
};
|
};
|
||||||
|
@ -20,12 +20,14 @@ namespace Aurora::IO::Net
|
|||||||
{
|
{
|
||||||
DatagramServer::DatagramServer(NetInterface *pInterface,
|
DatagramServer::DatagramServer(NetInterface *pInterface,
|
||||||
NetWorker *pWorker,
|
NetWorker *pWorker,
|
||||||
const AuSPtr<IDatagramDriver> &pDriver) :
|
const AuSPtr<IDatagramDriver> &pDriver,
|
||||||
SocketServerImpl(pInterface,
|
AuUInt32 uDefaultPacketSize) :
|
||||||
pWorker,
|
SocketServerImpl(pInterface, // struct NetInterface *pInterface
|
||||||
{},
|
pWorker, // struct NetWorker *pWorker
|
||||||
{},
|
{}, // const AuSPtr<ISocketServerDriver> &pDriver
|
||||||
4096,
|
{}, // const AuSPtr<ISocketDriverFactory> &pFactory
|
||||||
|
4096, // uMaxConnections
|
||||||
|
uDefaultPacketSize, // uDefaultInputStreamSize
|
||||||
true),
|
true),
|
||||||
pDriver_(pDriver)
|
pDriver_(pDriver)
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,8 @@ namespace Aurora::IO::Net
|
|||||||
|
|
||||||
DatagramServer(struct NetInterface *pInterface,
|
DatagramServer(struct NetInterface *pInterface,
|
||||||
struct NetWorker *pWorker,
|
struct NetWorker *pWorker,
|
||||||
const AuSPtr<IDatagramDriver> &pDriver);
|
const AuSPtr<IDatagramDriver> &pDriver,
|
||||||
|
AuUInt32 uDefaultPacketSize);
|
||||||
|
|
||||||
void BeginUDPLoop();
|
void BeginUDPLoop();
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ namespace Aurora::IO::Net
|
|||||||
|
|
||||||
virtual void DoPosixTick() = 0;
|
virtual void DoPosixTick() = 0;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
AuSPtr<IDatagramDriver> pDriver_;
|
AuSPtr<IDatagramDriver> pDriver_;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,11 @@ namespace Aurora::IO::Net
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return EndpointToLength(ep);
|
||||||
|
}
|
||||||
|
|
||||||
|
AuUInt8 EndpointToLength(const NetEndpoint &ep)
|
||||||
|
{
|
||||||
switch (ep.ip.ip)
|
switch (ep.ip.ip)
|
||||||
{
|
{
|
||||||
case EIPProtocol::eIPProtocolV6:
|
case EIPProtocol::eIPProtocolV6:
|
||||||
|
@ -17,4 +17,6 @@ namespace Aurora::IO::Net
|
|||||||
AuUInt TransportToPlatformType(ETransportProtocol protocol);
|
AuUInt TransportToPlatformType(ETransportProtocol protocol);
|
||||||
|
|
||||||
AuUInt IPToDomain(const NetEndpoint &ep);
|
AuUInt IPToDomain(const NetEndpoint &ep);
|
||||||
|
|
||||||
|
AuUInt8 EndpointToLength(const NetEndpoint &ep);
|
||||||
}
|
}
|
@ -11,6 +11,7 @@
|
|||||||
#include "AuNetWorker.hpp"
|
#include "AuNetWorker.hpp"
|
||||||
#include "AuIPAddress.hpp"
|
#include "AuIPAddress.hpp"
|
||||||
#include "AuNetError.hpp"
|
#include "AuNetError.hpp"
|
||||||
|
#include "AuNetSocketServer.hpp"
|
||||||
|
|
||||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||||
#include "AuNetStream.NT.hpp"
|
#include "AuNetStream.NT.hpp"
|
||||||
@ -341,8 +342,13 @@ namespace Aurora::IO::Net
|
|||||||
return this->pWorker_;
|
return this->pWorker_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SocketBase::SendPreestablish()
|
bool SocketBase::SendPreestablish(SocketServer *pServer)
|
||||||
{
|
{
|
||||||
|
if (pServer && pServer->uDefaultInputStreamSize)
|
||||||
|
{
|
||||||
|
this->socketChannel_.uBytesInputBuffer = pServer->uDefaultInputStreamSize;
|
||||||
|
}
|
||||||
|
|
||||||
this->socketChannel_.inputChannel.WarmOnEstablish(); // Allocate stream resources, in case we need to start working with the source buffer
|
this->socketChannel_.inputChannel.WarmOnEstablish(); // Allocate stream resources, in case we need to start working with the source buffer
|
||||||
// think: setting up protocol stacks, accessing the base bytebuffer, without the pipe being
|
// think: setting up protocol stacks, accessing the base bytebuffer, without the pipe being
|
||||||
// allocated already
|
// allocated already
|
||||||
|
@ -76,7 +76,7 @@ namespace Aurora::IO::Net
|
|||||||
INetWorker *ToWorker();
|
INetWorker *ToWorker();
|
||||||
NetWorker *ToWorkerEx();
|
NetWorker *ToWorkerEx();
|
||||||
|
|
||||||
bool SendPreestablish();
|
bool SendPreestablish(struct SocketServer *pServer = nullptr);
|
||||||
void SendEnd();
|
void SendEnd();
|
||||||
void SendFinalize();
|
void SendFinalize();
|
||||||
|
|
||||||
|
@ -22,7 +22,8 @@ namespace Aurora::IO::Net
|
|||||||
pWorker,
|
pWorker,
|
||||||
pDriver,
|
pDriver,
|
||||||
pSocketDriverFactory,
|
pSocketDriverFactory,
|
||||||
maxConnections,
|
uMaxConnections,
|
||||||
|
uDefaultInputStreamSize,
|
||||||
bMultiThreaded),
|
bMultiThreaded),
|
||||||
Socket(pInterface,
|
Socket(pInterface,
|
||||||
pWorker,
|
pWorker,
|
||||||
|
@ -17,7 +17,8 @@ namespace Aurora::IO::Net
|
|||||||
struct NetWorker *pWorker,
|
struct NetWorker *pWorker,
|
||||||
const AuSPtr<ISocketServerDriver> &pDriver,
|
const AuSPtr<ISocketServerDriver> &pDriver,
|
||||||
const AuSPtr<ISocketDriverFactory> &pSocketDriverFactory,
|
const AuSPtr<ISocketDriverFactory> &pSocketDriverFactory,
|
||||||
AuUInt32 maxConnections,
|
AuUInt32 uMaxConnections,
|
||||||
|
AuUInt32 uDefaultInputStreamSize,
|
||||||
bool bMultiThreaded);
|
bool bMultiThreaded);
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,13 +16,15 @@ namespace Aurora::IO::Net
|
|||||||
NetWorker *pWorker,
|
NetWorker *pWorker,
|
||||||
const AuSPtr<ISocketServerDriver> &pDriver,
|
const AuSPtr<ISocketServerDriver> &pDriver,
|
||||||
const AuSPtr<ISocketDriverFactory> &pSocketDriverFactory,
|
const AuSPtr<ISocketDriverFactory> &pSocketDriverFactory,
|
||||||
AuUInt32 maxConnections,
|
AuUInt32 uMaxConnections,
|
||||||
|
AuUInt32 uDefaultInputStreamSize,
|
||||||
bool bMultiThreaded) :
|
bool bMultiThreaded) :
|
||||||
SocketServer(pInterface,
|
SocketServer(pInterface,
|
||||||
pWorker,
|
pWorker,
|
||||||
pDriver,
|
pDriver,
|
||||||
pSocketDriverFactory,
|
pSocketDriverFactory,
|
||||||
maxConnections,
|
uMaxConnections,
|
||||||
|
uDefaultInputStreamSize,
|
||||||
bMultiThreaded),
|
bMultiThreaded),
|
||||||
Socket(pInterface,
|
Socket(pInterface,
|
||||||
pWorker,
|
pWorker,
|
||||||
|
@ -17,7 +17,8 @@ namespace Aurora::IO::Net
|
|||||||
struct NetWorker *pWorker,
|
struct NetWorker *pWorker,
|
||||||
const AuSPtr<ISocketServerDriver> &pDriver,
|
const AuSPtr<ISocketServerDriver> &pDriver,
|
||||||
const AuSPtr<ISocketDriverFactory> &pSocketDriverFactory,
|
const AuSPtr<ISocketDriverFactory> &pSocketDriverFactory,
|
||||||
AuUInt32 maxConnections,
|
AuUInt32 uMaxConnections,
|
||||||
|
AuUInt32 uDefaultInputStreamSize,
|
||||||
bool bMultiThreaded);
|
bool bMultiThreaded);
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,8 @@ namespace Aurora::IO::Net
|
|||||||
NetWorker *pWorker,
|
NetWorker *pWorker,
|
||||||
const AuSPtr<ISocketServerDriver> &pDriver,
|
const AuSPtr<ISocketServerDriver> &pDriver,
|
||||||
const AuSPtr<ISocketDriverFactory> &pFactory,
|
const AuSPtr<ISocketDriverFactory> &pFactory,
|
||||||
AuUInt32 maxConnections,
|
AuUInt32 uMaxConnections,
|
||||||
|
AuUInt32 uDefaultInputStreamSize,
|
||||||
bool bMultiThreaded)
|
bool bMultiThreaded)
|
||||||
: Socket(pInterface,
|
: Socket(pInterface,
|
||||||
pWorker,
|
pWorker,
|
||||||
@ -25,7 +26,8 @@ namespace Aurora::IO::Net
|
|||||||
-1),
|
-1),
|
||||||
pDriver_(pDriver),
|
pDriver_(pDriver),
|
||||||
pFactory_(pFactory),
|
pFactory_(pFactory),
|
||||||
uMaxConnections_(maxConnections),
|
uMaxConnections_(uMaxConnections),
|
||||||
|
uDefaultInputStreamSize(uDefaultInputStreamSize),
|
||||||
bMultiThreaded(bMultiThreaded)
|
bMultiThreaded(bMultiThreaded)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@ namespace Aurora::IO::Net
|
|||||||
struct NetWorker *pWorker,
|
struct NetWorker *pWorker,
|
||||||
const AuSPtr<ISocketServerDriver> &pDriver,
|
const AuSPtr<ISocketServerDriver> &pDriver,
|
||||||
const AuSPtr<ISocketDriverFactory> &pFactory,
|
const AuSPtr<ISocketDriverFactory> &pFactory,
|
||||||
AuUInt32 maxConnections,
|
AuUInt32 uMaxConnections,
|
||||||
|
AuUInt32 uDefaultInputStreamSize,
|
||||||
bool bMultiThreaded);
|
bool bMultiThreaded);
|
||||||
|
|
||||||
void Init(const NetEndpoint &localAddress);
|
void Init(const NetEndpoint &localAddress);
|
||||||
@ -49,6 +50,7 @@ namespace Aurora::IO::Net
|
|||||||
virtual void DetroyServer() = 0;
|
virtual void DetroyServer() = 0;
|
||||||
|
|
||||||
const bool bMultiThreaded;
|
const bool bMultiThreaded;
|
||||||
|
const AuUInt32 uDefaultInputStreamSize;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// INTERFACE: base os socket
|
// INTERFACE: base os socket
|
||||||
|
56
Source/IO/Net/AuNetSocketServerOnRead.Unix.cpp
Executable file
56
Source/IO/Net/AuNetSocketServerOnRead.Unix.cpp
Executable file
@ -0,0 +1,56 @@
|
|||||||
|
/***
|
||||||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||||
|
|
||||||
|
File: AuNetSocketServerOnRead.Unix.cpp
|
||||||
|
Date: 2022-12-16
|
||||||
|
Author: Reece
|
||||||
|
***/
|
||||||
|
#if 0
|
||||||
|
#include "Networking.hpp"
|
||||||
|
#include "AuNetSocketServer.hpp"
|
||||||
|
#include "AuNetSocket.hpp"
|
||||||
|
#include "AuNetEndpoint.hpp"
|
||||||
|
#include "AuNetInterface.hpp"
|
||||||
|
#include "AuNetWorker.hpp"
|
||||||
|
#include "AuNetEndpoint.hpp"
|
||||||
|
#include "AuNetSocketServerOnRead.Unix.hpp"
|
||||||
|
|
||||||
|
namespace Aurora::IO::Net
|
||||||
|
{
|
||||||
|
NetSocketServerOnRead::NetSocketServerOnRead(NetInterface *pInterface,
|
||||||
|
Socket *pParent) :
|
||||||
|
pInterface_(pInterface),
|
||||||
|
SocketServerAcceptReadOperationBase(pParent)
|
||||||
|
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetSocketServerOnRead::Destroy()
|
||||||
|
{
|
||||||
|
if (this->pWatch_)
|
||||||
|
{
|
||||||
|
this->pWatch_->StopWatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NetSocketServerOnRead::DoTick()
|
||||||
|
{
|
||||||
|
// this->pParent_->DoPosixTick();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NetSocketServerOnRead::InitOnce()
|
||||||
|
{
|
||||||
|
auto pWaitHandle = AuMakeShared<Loop::LSHandle>(this->pParent_->ToPlatformHandle(), -1);
|
||||||
|
if (!pWaitHandle)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->pWatch_ = this->pParent_->ToWorker()->ToProcessor()->StartSimpleLSWatchEx(pWaitHandle,
|
||||||
|
AuSPtr<IIOSimpleEventListener>(this->pParent_->SharedFromThis(), this),
|
||||||
|
false);
|
||||||
|
return bool(this->pWatch_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
32
Source/IO/Net/AuNetSocketServerOnRead.Unix.hpp
Executable file
32
Source/IO/Net/AuNetSocketServerOnRead.Unix.hpp
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
/***
|
||||||
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||||
|
|
||||||
|
File: AuNetSocketServerOnRead.Unix.hpp
|
||||||
|
Date: 2022-12-16
|
||||||
|
Author: Reece
|
||||||
|
***/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "AuNetSocketServerAcceptReadOperation.hpp"
|
||||||
|
|
||||||
|
namespace Aurora::IO::Net
|
||||||
|
{
|
||||||
|
struct NetInterface;
|
||||||
|
struct Socket;
|
||||||
|
|
||||||
|
struct NetSocketServerOnRead :
|
||||||
|
virtual SocketServerAcceptReadOperationBase
|
||||||
|
{
|
||||||
|
NetSocketServerOnRead(NetInterface *pInterface,
|
||||||
|
Socket *pParent);
|
||||||
|
|
||||||
|
bool DoTick();
|
||||||
|
bool InitOnce();
|
||||||
|
void Destroy();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NetInterface *pInterface_;
|
||||||
|
Socket *pParent_;
|
||||||
|
AuSPtr<IIOProcessorItem> pWatch_;
|
||||||
|
};
|
||||||
|
}
|
@ -42,7 +42,8 @@ namespace Aurora::IO::Net
|
|||||||
|
|
||||||
auto pServer = AuMakeShared<DatagramServerImpl>(this->pParent_,
|
auto pServer = AuMakeShared<DatagramServerImpl>(this->pParent_,
|
||||||
pWorker.get(),
|
pWorker.get(),
|
||||||
bind.pDriver);
|
bind.pDriver,
|
||||||
|
bind.uDefaultInputStreamSize);
|
||||||
if (!pServer)
|
if (!pServer)
|
||||||
{
|
{
|
||||||
SysPushErrorNet("No Memory");
|
SysPushErrorNet("No Memory");
|
||||||
|
@ -178,6 +178,7 @@ namespace Aurora::IO::Net
|
|||||||
netBind.pDriver,
|
netBind.pDriver,
|
||||||
netBind.pFactory,
|
netBind.pFactory,
|
||||||
uMaxSockets,
|
uMaxSockets,
|
||||||
|
netBind.uDefaultInputStreamSize,
|
||||||
netBind.bMultiThreaded);
|
netBind.bMultiThreaded);
|
||||||
if (!pSocket)
|
if (!pSocket)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "AuNetStream.Linux.hpp"
|
#include "AuNetStream.Linux.hpp"
|
||||||
#include "AuNetSocket.hpp"
|
#include "AuNetSocket.hpp"
|
||||||
#include "AuNetWorker.hpp"
|
#include "AuNetWorker.hpp"
|
||||||
|
#include "AuNetEndpoint.hpp"
|
||||||
#include <Source/IO/Loop/LSEvent.hpp>
|
#include <Source/IO/Loop/LSEvent.hpp>
|
||||||
|
|
||||||
namespace Aurora::IO::Net
|
namespace Aurora::IO::Net
|
||||||
@ -159,12 +160,23 @@ namespace Aurora::IO::Net
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
this->iSocketLength = this->pSocket->endpointSize_;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
AuLogDbg("{} -> {} {}, {}, {} {}", this->GetSocket(),
|
||||||
|
memoryView->ptr,
|
||||||
|
memoryView->length,
|
||||||
|
0,
|
||||||
|
(void *)netEndpoint.hint,
|
||||||
|
this->iSocketLength);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (::sendto(this->GetSocket(),
|
if (::sendto(this->GetSocket(),
|
||||||
memoryView->ptr,
|
memoryView->ptr,
|
||||||
memoryView->length,
|
memoryView->length,
|
||||||
0,
|
0,
|
||||||
(struct sockaddr *)netEndpoint.hint,
|
(struct sockaddr *)netEndpoint.hint,
|
||||||
this->iSocketLength) != memoryView->length)
|
EndpointToLength(netEndpoint)) != memoryView->length)
|
||||||
{
|
{
|
||||||
LIOS_SendProcess(0, false, errno);
|
LIOS_SendProcess(0, false, errno);
|
||||||
return true;
|
return true;
|
||||||
|
@ -229,7 +229,7 @@ namespace Aurora::IO::Net
|
|||||||
NULL,
|
NULL,
|
||||||
this->dwRecvFlags,
|
this->dwRecvFlags,
|
||||||
(sockaddr *)netEndpoint.hint,
|
(sockaddr *)netEndpoint.hint,
|
||||||
this->iSocketLength,
|
EndpointToLength(netEndpoint),
|
||||||
&this->overlap,
|
&this->overlap,
|
||||||
WsaOverlappedCompletionRoutine);
|
WsaOverlappedCompletionRoutine);
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,7 @@ namespace Aurora::IO::Net
|
|||||||
AuNet::NetDatagramBind nsDatagramBind;
|
AuNet::NetDatagramBind nsDatagramBind;
|
||||||
nsDatagramBind.ip = this->localEndpoint.ip;
|
nsDatagramBind.ip = this->localEndpoint.ip;
|
||||||
nsDatagramBind.uPort = this->localEndpoint.uPort;
|
nsDatagramBind.uPort = this->localEndpoint.uPort;
|
||||||
|
nsDatagramBind.uDefaultInputStreamSize = this->uDefaultPacketSize;
|
||||||
nsDatagramBind.pDriver = this->ToDriver();
|
nsDatagramBind.pDriver = this->ToDriver();
|
||||||
|
|
||||||
this->pDatagramServer_ = this->pInterface_->GetDatagramService()->NewDatagramServer(nsDatagramBind);
|
this->pDatagramServer_ = this->pInterface_->GetDatagramService()->NewDatagramServer(nsDatagramBind);
|
||||||
|
@ -187,7 +187,7 @@ namespace Aurora::RNG
|
|||||||
void EntropyDeinit()
|
void EntropyDeinit()
|
||||||
{
|
{
|
||||||
#if defined(AURORA_IS_POSIX_DERIVED)
|
#if defined(AURORA_IS_POSIX_DERIVED)
|
||||||
if (gDevURand <= 0)
|
if (gDevURand > 0)
|
||||||
{
|
{
|
||||||
::close(gDevURand);
|
::close(gDevURand);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user