Fixed minore mem leaks

This commit is contained in:
lganzzzo 2018-06-24 03:38:37 +03:00
parent b7ab204a6d
commit e9191b2b27
2 changed files with 12 additions and 1 deletions

View File

@ -36,6 +36,7 @@ public:
typedef oatpp::async::Action Action;
typedef oatpp::async::Action (oatpp::async::AbstractCoroutine::*AsyncCallback)(const std::shared_ptr<IOStream>&);
public:
virtual ~ConnectionProvider() {}
virtual std::shared_ptr<IOStream> getConnection() = 0;
virtual Action getConnectionAsync(oatpp::async::AbstractCoroutine* parentCoroutine,
AsyncCallback callback) = 0;

View File

@ -52,11 +52,21 @@ public:
return std::shared_ptr<SimpleTCPConnectionProvider>(new SimpleTCPConnectionProvider(port, nonBlocking));
}
~SimpleTCPConnectionProvider() {
oatpp::os::io::Library::handle_close(m_serverHandle);
}
std::shared_ptr<IOStream> getConnection() override;
Action getConnectionAsync(oatpp::async::AbstractCoroutine* parentCoroutine,
AsyncCallback callback) override {
throw std::runtime_error("oatpp::network::server::SimpleTCPConnectionProvider::getConnectionAsync not implemented");
/**
* No need to implement this.
* For Asynchronous IO in oatpp it is considered to be a good practice
* to accept connections in a seperate thread with the blocking accept()
* and then process connections in Asynchronous manner with non-blocking read/write
*/
throw std::runtime_error("oatpp::network::server::SimpleTCPConnectionProvider::getConnectionAsync not implemented.");
}
};