]> git.sesse.net Git - cubemap/blobdiff - stream.cpp
Compute the checksum on outgoing Metacube packets as well.
[cubemap] / stream.cpp
index 6563b5b3d9e5f39f563aeecf2382ea72cb74f38c..42edee95aae01176e94c3a63ab47704a95b19a36 100644 (file)
@@ -9,7 +9,7 @@
 #include <vector>
 
 #include "log.h"
-#include "metacube.h"
+#include "metacube2.h"
 #include "state.pb.h"
 #include "stream.h"
 #include "util.h"
@@ -219,13 +219,14 @@ void Stream::add_data_deferred(const char *data, size_t bytes, StreamStartSuitab
 
        if (encoding == Stream::STREAM_ENCODING_METACUBE) {
                // Add a Metacube block header before the data.
-               metacube_block_header hdr;
-               memcpy(hdr.sync, METACUBE_SYNC, sizeof(hdr.sync));
+               metacube2_block_header hdr;
+               memcpy(hdr.sync, METACUBE2_SYNC, sizeof(hdr.sync));
                hdr.size = htonl(bytes);
-               hdr.flags = htonl(0);
+               hdr.flags = htons(0);
                if (suitable_for_stream_start == NOT_SUITABLE_FOR_STREAM_START) {
-                       hdr.flags |= htonl(METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START);
+                       hdr.flags |= htons(METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START);
                }
+               hdr.csum = htons(metacube2_compute_crc(&hdr));
 
                iovec iov;
                iov.iov_base = new char[bytes + sizeof(hdr)];