mirror of
https://gitee.com/zyjblog/oatpp.git
synced 2024-12-22 22:16:37 +08:00
tcp::server::ConnectionProvider: remove unused code
This commit is contained in:
parent
b50783a6a7
commit
110e71f4f2
@ -315,19 +315,7 @@ oatpp::v_io_handle ConnectionProvider::instantiateServer(){
|
||||
|
||||
#endif
|
||||
|
||||
bool 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;
|
||||
}
|
||||
}
|
||||
void ConnectionProvider::prepareConnectionHandle(oatpp::v_io_handle handle) {
|
||||
|
||||
#ifdef SO_NOSIGPIPE
|
||||
int yes = 1;
|
||||
@ -337,22 +325,22 @@ bool ConnectionProvider::prepareConnectionHandle(oatpp::v_io_handle handle) {
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
provider::ResourceHandle<data::stream::IOStream> ConnectionProvider::getDefaultConnection() {
|
||||
|
||||
oatpp::v_io_handle handle = accept(m_serverHandle, nullptr, nullptr);
|
||||
|
||||
if(prepareConnectionHandle(handle)) {
|
||||
return provider::ResourceHandle<data::stream::IOStream>(
|
||||
std::make_shared<Connection>(handle),
|
||||
m_invalidator
|
||||
);
|
||||
if(!oatpp::isValidIOHandle(handle)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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)) {
|
||||
return provider::ResourceHandle<data::stream::IOStream>(
|
||||
std::make_shared<ExtendedConnection>(handle, std::move(properties)),
|
||||
m_invalidator
|
||||
);
|
||||
}
|
||||
prepareConnectionHandle(handle);
|
||||
|
||||
return nullptr;
|
||||
return provider::ResourceHandle<data::stream::IOStream>(
|
||||
std::make_shared<ExtendedConnection>(handle, std::move(properties)),
|
||||
m_invalidator
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ private:
|
||||
private:
|
||||
oatpp::v_io_handle instantiateServer();
|
||||
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> getExtendedConnection();
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user