|
1 | 1 | /* |
2 | 2 | * Copyright (C) 2012-2023 Fanout, Inc. |
3 | | - * Copyright (C) 2024 Fastly, Inc. |
| 3 | + * Copyright (C) 2024-2025 Fastly, Inc. |
4 | 4 | * |
5 | 5 | * This file is part of Pushpin. |
6 | 6 | * |
|
36 | 36 | #include "qtcompat.h" |
37 | 37 | #include "bufferlist.h" |
38 | 38 | #include "log.h" |
| 39 | +#include "defercall.h" |
39 | 40 | #include "layertracker.h" |
40 | 41 | #include "sockjsmanager.h" |
41 | 42 | #include "inspectdata.h" |
@@ -200,6 +201,7 @@ class RequestSession::Private : public QObject |
200 | 201 | ZhttpReqConnections zhttpReqConnections; |
201 | 202 | Connection inspectFinishedConnection; |
202 | 203 | Connection acceptFinishedConnection; |
| 204 | + DeferCall deferCall; |
203 | 205 |
|
204 | 206 | Private(RequestSession *_q, int _workerId, DomainMap *_domainMap = 0, SockJsManager *_sockJsManager = 0, ZrpcManager *_inspectManager = 0, ZrpcChecker *_inspectChecker = 0, ZrpcManager *_acceptManager = 0, StatsManager *_stats = 0) : |
205 | 207 | QObject(_q), |
@@ -308,7 +310,7 @@ class RequestSession::Private : public QObject |
308 | 310 | isSockJs = true; |
309 | 311 | sockJsManager->giveRequest(zhttpRequest, route.sockJsPath.length(), route.sockJsAsPath, route); |
310 | 312 | zhttpRequest = 0; |
311 | | - QMetaObject::invokeMethod(this, "doFinished", Qt::QueuedConnection); |
| 313 | + deferCall.defer([=] { doFinished(); }); |
312 | 314 | return; |
313 | 315 | } |
314 | 316 | } |
@@ -480,7 +482,7 @@ class RequestSession::Private : public QObject |
480 | 482 | if(!inspectRequest) |
481 | 483 | { |
482 | 484 | log_debug("inspect not available"); |
483 | | - QMetaObject::invokeMethod(this, "doInspectError", Qt::QueuedConnection); |
| 485 | + deferCall.defer([=] { doInspectError(); }); |
484 | 486 | } |
485 | 487 | } |
486 | 488 | } |
@@ -559,7 +561,7 @@ class RequestSession::Private : public QObject |
559 | 561 | if(!pendingResponseUpdate) |
560 | 562 | { |
561 | 563 | pendingResponseUpdate = true; |
562 | | - QMetaObject::invokeMethod(this, "doResponseUpdate", Qt::QueuedConnection); |
| 564 | + deferCall.defer([=] { doResponseUpdate(); }); |
563 | 565 | } |
564 | 566 | } |
565 | 567 |
|
@@ -973,7 +975,6 @@ class RequestSession::Private : public QObject |
973 | 975 | } |
974 | 976 | } |
975 | 977 |
|
976 | | -public slots: |
977 | 978 | void doResponseUpdate() |
978 | 979 | { |
979 | 980 | pendingResponseUpdate = false; |
|
0 commit comments