restbed icon indicating copy to clipboard operation
restbed copied to clipboard

Error in websocket example

Open stkrwork opened this issue 9 years ago • 10 comments

When using the web_socket example, i get an error bad file descriptor on the console right after closing the connection.

Here is the log: Sent welcome message to 3a64fe9d-cf53-48c4-a9f3-b1a830d55cd7. Closed connection to 3a64fe9d-cf53-48c4-a9f3-b1a830d55cd7. WebSocket Errored 'Bad file descriptor' for 3a64fe9d-cf53-48c4-a9f3-b1a830d55cd7.

i use the simple websocket client extension in chrome as a debug client.

The example does not crash.

stkrwork avatar Apr 11 '17 16:04 stkrwork

Thanks for reporting this will look into it shortly.

ben-crowhurst avatar Apr 12 '17 10:04 ben-crowhurst

Is there any update to this?

stkrwork avatar May 02 '17 07:05 stkrwork

After looking into the source code, I saw that by adding a check for m_is_open in socket_impl.cpp in the read and write functions, this error disappears.

stkrwork avatar May 02 '17 09:05 stkrwork

Awesome please provide a PR. Sorry we haven't made time for this yet we are beavering away with the upcoming 5.0 release.

ben-crowhurst avatar May 02 '17 09:05 ben-crowhurst

#208 is the pull request

stkrwork avatar May 02 '17 09:05 stkrwork

Thanks, I'll action this before end of the week.

ben-crowhurst avatar May 03 '17 07:05 ben-crowhurst

Attempted to look into this however formatting has gone loopy as all the whitespace has changed.

https://github.com/Corvusoft/restbed/pull/208/commits/2966cfeb5593ba4efc776a0dc3a1bc8fcd0afaba

Please format the code as per restbed/tool/astyle/options prior to committing. To ease future development we have supplied a pre-commit hook under restbed/tool/git/pre-commit.

ben-crowhurst avatar May 07 '17 02:05 ben-crowhurst

I made another commit that highlights the changes i made.

stkrwork avatar May 08 '17 08:05 stkrwork

#210 new pull request

stkrwork avatar May 09 '17 11:05 stkrwork

Great work @stkrwork.

ben-crowhurst avatar May 09 '17 11:05 ben-crowhurst