File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1487,6 +1487,8 @@ class Session final : public ProtocolHandlerInterface
1487
1487
{
1488
1488
LOG_ERR (" Error while invoking onFinished client callback: " << exc.what ());
1489
1489
}
1490
+
1491
+ _onFinished = nullptr ;
1490
1492
}
1491
1493
1492
1494
// / Set up a new request and response.
@@ -1891,6 +1893,30 @@ class ServerSession final : public ProtocolHandlerInterface
1891
1893
// / regardless of the reason (error, timeout, completion).
1892
1894
void setFinishedHandler (FinishedCallback onFinished) { _onFinished = std::move (onFinished); }
1893
1895
1896
+ std::shared_ptr<ServerSession> shared_from_this ()
1897
+ {
1898
+ return std::static_pointer_cast<ServerSession>(ProtocolHandlerInterface::shared_from_this ());
1899
+ }
1900
+
1901
+ void callOnFinished ()
1902
+ {
1903
+ fprintf (stderr, " ServerSession onFinished\n " );
1904
+
1905
+ if (!_onFinished)
1906
+ return ;
1907
+
1908
+ LOG_TRC (" onFinished calling client" );
1909
+ std::shared_ptr<ServerSession> self = shared_from_this ();
1910
+ try
1911
+ {
1912
+ _onFinished (self);
1913
+ }
1914
+ catch (const std::exception& exc)
1915
+ {
1916
+ LOG_ERR (" Error while invoking onFinished client callback: " << exc.what ());
1917
+ }
1918
+ }
1919
+
1894
1920
using ResponseHeaders = http::Header::Container;
1895
1921
1896
1922
// / Start an asynchronous upload from a file.
@@ -2191,6 +2217,7 @@ class ServerSession final : public ProtocolHandlerInterface
2191
2217
}
2192
2218
2193
2219
_connected = false ;
2220
+ callOnFinished ();
2194
2221
}
2195
2222
2196
2223
int sendTextMessage (const char *, const size_t , bool ) const override { return 0 ; }
You can’t perform that action at this time.
0 commit comments