Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling the exception that may occur when writing on socket #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rolancia
Copy link

Hi Sir,

i faced an error when writing on socket with multi users.

i had checked out below you used
'https://github.com/nodejs/node/blob/master/lib/net.js'

it calls 'emit('close', ...) after already closed, so assumed your '_closed' value might be not synchronized.

Thank you
Rolancia

@rolancia
Copy link
Author

rolancia commented Jan 16, 2020

if users didn't put error handler, the process will be terminated when exception occurs while calling _socket.write in 'sendMessage' due to the default error handler kills the process with exit code 1.

i thought the user using this library may not want to face the exception. it might happen very rarely but it will happen someday. example, i had encountered that everyday.

i think the throwing code i put can prevent that
(in the beginning i put a code defining default handler but it could be bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant