From df9e60281931844ea63a365c920c3b1a4dc8d8e1 Mon Sep 17 00:00:00 2001 From: AlexeyAB Date: Sun, 1 Mar 2020 18:02:54 +0300 Subject: [PATCH] Fixed bug in MJPEG_PORT - clear socket after closing the connection --- src/http_stream.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/http_stream.cpp b/src/http_stream.cpp index 1f3d138d..c71a7f47 100644 --- a/src/http_stream.cpp +++ b/src/http_stream.cpp @@ -258,10 +258,11 @@ public: //_write(s, head, 0); if (!close_all_sockets) _write(s, ", \n", 0); int n = _write(s, outputbuf, outlen); - if (n < outlen) + if (n < (int)outlen) { cerr << "JSON_sender: kill client " << s << endl; - ::shutdown(s, 2); + close_socket(s); + //::shutdown(s, 2); FD_CLR(s, &master); } @@ -448,7 +449,7 @@ public: cv::imencode(".jpg", frame, outbuf, params); //REMOVED FOR COMPATIBILITY // https://docs.opencv.org/3.4/d4/da8/group__imgcodecs.html#ga292d81be8d76901bff7988d18d2b42ac //std::cerr << "cv::imencode call disabled!" << std::endl; - size_t outlen = outbuf.size(); + int outlen = static_cast(outbuf.size()); #ifdef _WIN32 for (unsigned i = 0; i