diff --git a/include/cppmicrohttpd/daemon.h b/include/cppmicrohttpd/daemon.h index 45c2db9..2665ddb 100644 --- a/include/cppmicrohttpd/daemon.h +++ b/include/cppmicrohttpd/daemon.h @@ -79,9 +79,9 @@ namespace cppmicrohttpd /** * @brief Get the timeout in milliseconds to wait for the file descriptors. * - * @return Timeout how many milliseconds select should at most block. + * @return Timeout how many milliseconds select should at most block (0r -1 if not relevant). */ - inline unsigned long long get_timeout() const; + inline long long get_timeout() const; protected: /** @@ -108,7 +108,7 @@ namespace cppmicrohttpd * @return The created response. */ virtual response_ptr_u create_response( - const request& p_request); + request& p_request); /** * @brief Create a default response object. diff --git a/include/cppmicrohttpd/daemon.inl b/include/cppmicrohttpd/daemon.inl index b8e14b1..623606b 100644 --- a/include/cppmicrohttpd/daemon.inl +++ b/include/cppmicrohttpd/daemon.inl @@ -36,12 +36,12 @@ namespace cppmicrohttpd return ret; } - unsigned long long daemon::get_timeout() const + long long daemon::get_timeout() const { unsigned long long timeout = 0; if (MHD_get_timeout(_handle.get(), &timeout) != MHD_YES) - throw exception("Unable to execute MHD_get_timeout"); - return timeout; + return -1; + return static_cast(timeout); } } diff --git a/src/cppmicrohttpd/damon.cpp b/src/cppmicrohttpd/damon.cpp index 72bfacf..9ea8b5a 100644 --- a/src/cppmicrohttpd/damon.cpp +++ b/src/cppmicrohttpd/damon.cpp @@ -38,7 +38,7 @@ request_ptr_u daemon::create_request( { return std::make_unique(p_connection, p_url, p_method, p_version); } response_ptr_u daemon::create_response( - const request& p_request) + request& p_request) { return create_default_response(p_request, true); } response_ptr_u daemon::create_default_response( @@ -144,28 +144,28 @@ int daemon::mhd_access_handler_callback( { cppmicrohttpd_log(warn) << "Error while handling post data: " << ex; req.set_error(ex); - *data_size = 0; // Assume that all data has been progressed + *data_size = 0; // Assume that all data has been processed return MHD_YES; } catch(const exception& ex) { cppmicrohttpd_log(warn) << "Error while handling post data: " << ex; req.set_error(ex); - *data_size = 0; // Assume that all data has been progressed + *data_size = 0; // Assume that all data has been processed return MHD_YES; } catch(std::exception& ex) { cppmicrohttpd_log(warn) << "Error while handling post data: " << ex.what(); req.set_error(exception(ex.what())); - *data_size = 0; // Assume that all data has been progressed + *data_size = 0; // Assume that all data has been processed return MHD_YES; } catch(...) { cppmicrohttpd_log(warn) << "Error while handling post data: unknown"; req.set_error(exception("Unknown error")); - *data_size = 0; // Assume that all data has been progressed + *data_size = 0; // Assume that all data has been processed return MHD_YES; }