Skip to content

Closing wss connections might not work as expected #120

@Davidiusdadi

Description

@Davidiusdadi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions