/* * Authored by Alex Hultman, 2018-2020. * Intellectual property of third-party. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef UWS_LOOPDATA_H #define UWS_LOOPDATA_H #include #include #include #include #include #include #include #include "PerMessageDeflate.h" #include "MoveOnlyFunction.h" struct us_timer_t; namespace uWS { struct Loop; struct alignas(16) LoopData { friend struct Loop; private: std::mutex deferMutex; int currentDeferQueue = 0; std::vector> deferQueues[2]; /* Map from void ptr to handler */ std::map> postHandlers, preHandlers; public: LoopData() { updateDate(); } ~LoopData() { /* If we have had App.ws called with compression we need to clear this */ if (zlibContext) { delete zlibContext; delete inflationStream; delete deflationStream; } delete [] corkBuffer; } void updateDate() { time_t now = time(0); struct tm tstruct = {}; #ifdef _WIN32 /* Micro, fucking soft never follows spec. */ gmtime_s(&tstruct, &now); #else gmtime_r(&now, &tstruct); #endif static const char wday_name[][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char mon_name[][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; snprintf(date, 32, "%.3s, %.2u %.3s %.4u %.2u:%.2u:%.2u GMT", wday_name[tstruct.tm_wday], tstruct.tm_mday % 99, mon_name[tstruct.tm_mon], (1900 + tstruct.tm_year) % 9999, tstruct.tm_hour % 99, tstruct.tm_min % 99, tstruct.tm_sec % 99); } char date[32]; /* Be silent */ bool noMark = false; /* Good 16k for SSL perf. */ static const unsigned int CORK_BUFFER_SIZE = 16 * 1024; /* Cork data */ char *corkBuffer = new char[CORK_BUFFER_SIZE]; unsigned int corkOffset = 0; void *corkedSocket = nullptr; /* Per message deflate data */ ZlibContext *zlibContext = nullptr; InflationStream *inflationStream = nullptr; DeflationStream *deflationStream = nullptr; us_timer_t *dateTimer; }; } #endif // UWS_LOOPDATA_H t Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2023-07-18Fix crash in postMessage that repro'd after ~100,000 messagesGravatar Jarred Sumner 6-21/+57
2023-07-18more progress on fixing gc issueGravatar Jarred Sumner 6-61/+162
2023-07-18add padding bytesGravatar Dylan Conway 1-1/+1
2023-07-18feature(constants) add constants/node:constants module and tests(prisma) use ...Gravatar Ciro Spaciari 16-20/+529
2023-07-18patch checkServerIdentity (#3671)Gravatar Ciro Spaciari 3-3/+9
2023-07-18Update workers.mdGravatar Jarred Sumner 1-2/+2
2023-07-18[jest] execute lifecycle hooks on empty blocks (#3663)Gravatar Alex Lam S.L 2-19/+79
2023-07-18ClarifyGravatar Jarred Sumner 1-0/+2
2023-07-18Fixes #3669Gravatar Jarred Sumner 4-13/+35
2023-07-18zig upgrade (#3667)Gravatar Dylan Conway 154-4894/+4857
2023-07-17Enable postgres prisma testGravatar Jarred Sumner 1-1/+1
2023-07-17Emit writeBarrier in `napi_module_register`Gravatar Jarred Sumner 1-6/+14
2023-07-17Fix potential crash in process.dlopen()Gravatar Jarred Sumner 2-5/+27
2023-07-17Implement `process.{stdout, stderr}.{columns, rows, getWindowSize}`Gravatar Jarred Sumner 4-32/+108
2023-07-17[tls] General compatibility improvements (#3596)Gravatar Ciro Spaciari 23-298/+2907
2023-07-17package json `main` field extension order (#3664)Gravatar Dylan Conway 3-3/+96
2023-07-17[install] handle duplicated workspace declarations gracefully (#3662)Gravatar Alex Lam S.L 2-6/+197
2023-07-17Clean up worker docsGravatar Colin McDonnell 1-65/+69
2023-07-17Tweak test docsGravatar Colin McDonnell 2-4/+3
2023-07-17workaround `readable-stream` compatibility (#3626)Gravatar Alex Lam S.L 3-4/+5
2023-07-17Fix flaky process testGravatar Jarred SUmner 1-2/+2
2023-07-17Fix test with incorrect textGravatar Jarred Sumner 1-3/+3
2023-07-17Fix incorrect nameGravatar Jarred Sumner 2-4/+4
2023-07-17Fix speculative crashes in console.log(formData) and console.log(headers)Gravatar Jarred Sumner 2-30/+24
2023-07-17Fix crash in console.log(urlSearchParams) on a URLSearchParams object with a ...Gravatar Jarred Sumner 2-4/+99
2023-07-17Fix memory leak in `await new Response(latin1String).arrayBuffer()` and `awai...Gravatar Jarred Sumner 16-102/+361
2023-07-1720% faster `deserialize` (#3655)Gravatar Jarred Sumner 2-12/+197
2023-07-16Document `--smol`Gravatar Jarred Sumner 1-70/+59
2023-07-16Add `--smol` to bunfigGravatar Jarred Sumner 1-0/+12
2023-07-16Document serialize/deserializeGravatar Jarred Sumner 1-0/+14