]> git.sesse.net Git - cubemap/blobdiff - stream.cpp
Fix 100% CPU usage when there is no access_log.
[cubemap] / stream.cpp
index 109d2fd4a90116398e8b638816872cabf06b22ce..83257e9046d3a9cbbd29756f100bedaed069df45 100644 (file)
@@ -1,14 +1,15 @@
-#include <arpa/inet.h>
+#include <assert.h>
 #include <errno.h>
-#include <stdio.h>
+#include <netinet/in.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 #include <string>
 #include <vector>
 
-#include "state.pb.h"
 #include "log.h"
 #include "metacube.h"
+#include "state.pb.h"
 #include "stream.h"
 #include "util.h"
 
@@ -109,6 +110,9 @@ void Stream::set_backlog_size(size_t new_size)
 
        // Create a new, empty data file.
        data_fd = make_tempfile("");
+       if (data_fd == -1) {
+               exit(1);
+       }
        backlog_size = new_size;
 
        // Now cheat a bit by rewinding, and adding all the old data back.