Add DEDICATED_DECOMPRESSOR CompressOption

This commit is contained in:
Alex Hultman
2021-09-28 04:06:49 +02:00
parent 7a3bc47f75
commit 415fec3830
6 changed files with 48 additions and 14 deletions
+12 -2
View File
@@ -46,6 +46,8 @@ private:
/* We might have a dedicated compressor */
DeflationStream *deflationStream = nullptr;
/* And / or a dedicated decompressor */
InflationStream *inflationStream = nullptr;
/* We could be a subscriber */
Subscriber *subscriber = nullptr;
@@ -53,10 +55,14 @@ public:
WebSocketData(bool perMessageDeflate, CompressOptions compressOptions, BackPressure &&backpressure) : AsyncSocketData<false>(std::move(backpressure)), WebSocketState<true>() {
compressionStatus = perMessageDeflate ? ENABLED : DISABLED;
/* Initialize the dedicated sliding window */
if (perMessageDeflate && (compressOptions != CompressOptions::SHARED_COMPRESSOR)) {
/* Initialize the dedicated sliding window(s) */
if (perMessageDeflate && (0 == (compressOptions & CompressOptions::SHARED_COMPRESSOR))) {
deflationStream = new DeflationStream(compressOptions);
}
if (perMessageDeflate && (compressOptions & CompressOptions::DEDICATED_DECOMPRESSOR)) {
inflationStream = new InflationStream();
}
}
~WebSocketData() {
@@ -64,6 +70,10 @@ public:
delete deflationStream;
}
if (inflationStream) {
delete inflationStream;
}
if (subscriber) {
delete subscriber;
}