]> git.sesse.net Git - nageru/blobdiff - httpd.cpp
Release Nageru 1.7.2.
[nageru] / httpd.cpp
index 9782dca7ba7807ab45c0e1994cd6a25642623086..f6441768bbdde1df3d31e2b42a2cb13430019376 100644 (file)
--- a/httpd.cpp
+++ b/httpd.cpp
@@ -30,13 +30,7 @@ HTTPD::HTTPD()
 
 HTTPD::~HTTPD()
 {
-       if (mhd) {
-               MHD_quiesce_daemon(mhd);
-               for (Stream *stream : streams) {
-                       stream->stop();
-               }
-               MHD_stop_daemon(mhd);
-       }
+       stop();
 }
 
 void HTTPD::start(int port)
@@ -52,6 +46,18 @@ void HTTPD::start(int port)
        }
 }
 
+void HTTPD::stop()
+{
+       if (mhd) {
+               MHD_quiesce_daemon(mhd);
+               for (Stream *stream : streams) {
+                       stream->stop();
+               }
+               MHD_stop_daemon(mhd);
+               mhd = nullptr;
+       }
+}
+
 void HTTPD::add_data(const char *buf, size_t size, bool keyframe, int64_t time, AVRational timebase)
 {
        unique_lock<mutex> lock(streams_mutex);