tcp::server::ConnectionProvider: remove unused code

This commit is contained in:
Leonid Stryzhevskyi 2023-03-12 04:19:33 +02:00
parent b50783a6a7
commit 110e71f4f2
2 changed files with 15 additions and 29 deletions

View File

@ -315,19 +315,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
#endif #endif
bool ConnectionProvider::prepareConnectionHandle(oatpp::v_io_handle handle) { void ConnectionProvider::prepareConnectionHandle(oatpp::v_io_handle handle) {
if (!oatpp::isValidIOHandle(handle)) {
v_int32 error = errno;
if(error == EAGAIN || error == EWOULDBLOCK){
return false;
} else {
if(!m_closed) { // m_serverHandle==0 if ConnectionProvider was closed. Not an error.
OATPP_LOGD("[oatpp::network::tcp::server::ConnectionProvider::prepareConnectionHandle()]", "Error. %d", error);
}
return false;
}
}
#ifdef SO_NOSIGPIPE #ifdef SO_NOSIGPIPE
int yes = 1; int yes = 1;
@ -337,22 +325,22 @@ bool ConnectionProvider::prepareConnectionHandle(oatpp::v_io_handle handle) {
} }
#endif #endif
return true;
} }
provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getDefaultConnection() { provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getDefaultConnection() {
oatpp::v_io_handle handle = accept(m_serverHandle, nullptr, nullptr); oatpp::v_io_handle handle = accept(m_serverHandle, nullptr, nullptr);
if(prepareConnectionHandle(handle)) { if(!oatpp::isValidIOHandle(handle)) {
return provider::ResourceHandle<data::stream::IOStream>( return nullptr;
std::make_shared<Connection>(handle),
m_invalidator
);
} }
return nullptr; prepareConnectionHandle(handle);
return provider::ResourceHandle<data::stream::IOStream>(
std::make_shared<Connection>(handle),
m_invalidator
);
} }
@ -402,14 +390,12 @@ provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getExtended
} }
if(prepareConnectionHandle(handle)) { prepareConnectionHandle(handle);
return provider::ResourceHandle<data::stream::IOStream>(
std::make_shared<ExtendedConnection>(handle, std::move(properties)),
m_invalidator
);
}
return nullptr; return provider::ResourceHandle<data::stream::IOStream>(
std::make_shared<ExtendedConnection>(handle, std::move(properties)),
m_invalidator
);
} }

View File

@ -92,7 +92,7 @@ private:
private: private:
oatpp::v_io_handle instantiateServer(); oatpp::v_io_handle instantiateServer();
private: private:
bool prepareConnectionHandle(oatpp::v_io_handle handle); void prepareConnectionHandle(oatpp::v_io_handle handle);
provider::ResourceHandle<data::stream::IOStream> getDefaultConnection(); provider::ResourceHandle<data::stream::IOStream> getDefaultConnection();
provider::ResourceHandle<data::stream::IOStream> getExtendedConnection(); provider::ResourceHandle<data::stream::IOStream> getExtendedConnection();
public: public: