Skip to content

Commit

Permalink
Allow having no close handler
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Jan 19, 2020
1 parent 61b6916 commit 0faebc7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ struct TemplatedApp {
webSocketContext->getExt()->messageHandler = std::move(behavior.message);
webSocketContext->getExt()->drainHandler = std::move(behavior.drain);
webSocketContext->getExt()->closeHandler = std::move([closeHandler = std::move(behavior.close)](WebSocket<SSL, true> *ws, int code, std::string_view message) mutable {
closeHandler(ws, code, message);
if (closeHandler) {
closeHandler(ws, code, message);
}

/* Destruct user data after returning from close handler */
((UserData *) ws->getUserData())->~UserData();
Expand Down

0 comments on commit 0faebc7

Please sign in to comment.