mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 21:55:03 +02:00
ElasticsearchWriter: don't leak sockets
refs #7018 (cherry picked from commit b2e2b587da530a5b79f746ed0db5b3804b502e07)
This commit is contained in:
parent
1fc3a77c4a
commit
29e8961cda
@ -25,6 +25,7 @@
|
|||||||
#include "icinga/compatutility.hpp"
|
#include "icinga/compatutility.hpp"
|
||||||
#include "icinga/service.hpp"
|
#include "icinga/service.hpp"
|
||||||
#include "icinga/checkcommand.hpp"
|
#include "icinga/checkcommand.hpp"
|
||||||
|
#include "base/defer.hpp"
|
||||||
#include "base/tcpsocket.hpp"
|
#include "base/tcpsocket.hpp"
|
||||||
#include "base/stream.hpp"
|
#include "base/stream.hpp"
|
||||||
#include "base/base64.hpp"
|
#include "base/base64.hpp"
|
||||||
@ -441,6 +442,8 @@ void ElasticsearchWriter::SendRequest(const String& body)
|
|||||||
if (!stream)
|
if (!stream)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Defer close ([&stream]() { stream->Close(); });
|
||||||
|
|
||||||
HttpRequest req(stream);
|
HttpRequest req(stream);
|
||||||
|
|
||||||
/* Specify required headers by Elasticsearch. */
|
/* Specify required headers by Elasticsearch. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user