Add SHARED and DEDICATED compressor options

This commit is contained in:
Alex Hultman
2018-12-22 05:58:26 +01:00
parent f8e299c312
commit 038111fb98
8 changed files with 114 additions and 91 deletions
+10 -2
View File
@@ -19,6 +19,7 @@
#include "WebSocketProtocol.h"
#include "AsyncSocketData.h"
#include "PerMessageDeflate.h"
#include <string>
@@ -37,10 +38,17 @@ private:
ENABLED,
COMPRESSED_FRAME
} compressionStatus;
/* We might have a dedicated compressor */
DeflationStream *deflationStream = nullptr;
public:
WebSocketData(bool perMessageDeflate) : WebSocketState<true>() {
//std::cout << "perMessageDeflate: " << perMessageDeflate << std::endl;
WebSocketData(bool perMessageDeflate, bool slidingCompression) : WebSocketState<true>() {
compressionStatus = perMessageDeflate ? ENABLED : DISABLED;
/* Initialize the dedicated sliding window */
if (perMessageDeflate && slidingCompression) {
deflationStream = new DeflationStream;
}
}
};