mirror of https://github.com/Icinga/icinga2.git
parent
9a06b09366
commit
092983d5ad
|
@ -43,7 +43,7 @@ String I2_BASE_API SHA256(const String& s);
|
||||||
class I2_BASE_API openssl_error : virtual public std::exception, virtual public boost::exception { };
|
class I2_BASE_API openssl_error : virtual public std::exception, virtual public boost::exception { };
|
||||||
|
|
||||||
struct errinfo_openssl_error_;
|
struct errinfo_openssl_error_;
|
||||||
typedef boost::error_info<struct errinfo_openssl_error_, int> errinfo_openssl_error;
|
typedef boost::error_info<struct errinfo_openssl_error_, unsigned long> errinfo_openssl_error;
|
||||||
|
|
||||||
inline std::string to_string(const errinfo_openssl_error& e)
|
inline std::string to_string(const errinfo_openssl_error& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,7 +116,21 @@ void ApiClient::DisconnectSync(void)
|
||||||
|
|
||||||
bool ApiClient::ProcessMessage(void)
|
bool ApiClient::ProcessMessage(void)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr message = JsonRpc::ReadMessage(m_Stream);
|
Dictionary::Ptr message;
|
||||||
|
|
||||||
|
if (m_Stream->IsEof())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
message = JsonRpc::ReadMessage(m_Stream);
|
||||||
|
} catch (const openssl_error& ex) {
|
||||||
|
const unsigned long *pe = boost::get_error_info<errinfo_openssl_error>(ex);
|
||||||
|
|
||||||
|
if (pe && *pe == 0)
|
||||||
|
return false; /* Connection was closed cleanly */
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
if (!message)
|
if (!message)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue