return statement to exit reading loop

Merges PR#2414

I used this example to start building my WebSocket application, however, I noticed that upon removing the echoing in the on_read method, the server repeatedly throws errors without exiting the method.

You can recreate this problem by replacing the async_write with do_write and cause any error (i.e. client reloads the page).

Adding a return statement here would make debugging for future changes much easier and it wouldn't harm the existing echoing in any way.
This commit is contained in:
oerol
2022-04-25 14:08:59 +02:00
committed by sehe
parent 95d9587ea7
commit 90e37ae40b

View File

@ -126,7 +126,7 @@ public:
return;
if(ec)
fail(ec, "read");
return fail(ec, "read");
// Echo the message
ws_.text(ws_.got_text());