Skip to content

Commit

Permalink
Allow having no open handler
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Jan 19, 2020
1 parent 5da9926 commit 588d234
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/App.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,14 @@ struct TemplatedApp {
webSocket->init(perMessageDeflate, slidingDeflateWindow, std::move(backpressure))
);

/* Emit open event and start the timeout */
if (behavior.open) {
us_socket_timeout(SSL, (us_socket_t *) webSocket, behavior.idleTimeout);
/* Arm idleTimeout */
us_socket_timeout(SSL, (us_socket_t *) webSocket, behavior.idleTimeout);

/* Default construct the UserData right before calling open handler */
new (webSocket->getUserData()) UserData;
/* Default construct the UserData right before calling open handler */
new (webSocket->getUserData()) UserData;

/* Emit open event and start the timeout */
if (behavior.open) {
behavior.open(webSocket, req);
}

Expand Down

0 comments on commit 588d234

Please sign in to comment.