This commit is contained in:
2025-03-11 19:37:36 +06:00
parent e190c79d00
commit 1710eb974d
10 changed files with 178 additions and 64 deletions

View File

@@ -120,10 +120,18 @@ coro<> AsyncSocket::read(std::byte *data, uint32_t size) {
void AsyncSocket::closeRead() {
if(Socket.is_open() && !ReadShutdowned) {
ReadShutdowned = true;
// TODO:
try { Socket.shutdown(boost::asio::socket_base::shutdown_receive); } catch(...) {}
}
}
void AsyncSocket::close() {
if(Socket.is_open()) {
Socket.close();
ReadShutdowned = true;
}
}
coro<> AsyncSocket::waitForSend() {
asio::deadline_timer waiter(IOC);

View File

@@ -239,6 +239,7 @@ protected:
coro<> read(std::byte *data, uint32_t size);
void closeRead();
void close();
template<typename T, std::enable_if_t<std::is_integral_v<T> or std::is_same_v<T, std::string>, int> = 0>
coro<T> read() {