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

Closing wss connections might not work as expected #120

Closed
Davidiusdadi opened this issue Sep 20, 2012 · 1 comment
Closed

Closing wss connections might not work as expected #120

Davidiusdadi opened this issue Sep 20, 2012 · 1 comment

Comments

@Davidiusdadi
Copy link
Collaborator

Communication via wss in general works fine by now.

Unfortunately closing wss connections is implemented in a very basic way:

public void close() throws IOException {
        sslEngine.closeOutbound();
        sslEngine.getSession().invalidate();
        if( sc.isOpen() )
            sc.write( wrap( emptybuffer ) );
        sc.close();
    }

It is possible that sc.write will not send enough bytes ( i measured 37 bytes ) at once to complete the TLS close notify. Calling sc.write in a loop might block the current thread indefinitely so that is not an option.

As a result your peer host might complain about an unexpectedly closed connection after HE initiated the websocket close handshake.

It will take me a few days to implement the close handshaking the nonblocking way.

Please excuse my humble English.

@marci4
Copy link
Collaborator

marci4 commented May 28, 2017

Code changed with #488.

Closing issue!
Greetings
marci4

@marci4 marci4 closed this as completed May 28, 2017
@marci4 marci4 added this to the Release 1.3.4 milestone May 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants