ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Ozerov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-1215) GridConnectionBytesVerifyFilter doesn't write magic header.
Date Fri, 07 Aug 2015 07:58:45 GMT
Vladimir Ozerov created IGNITE-1215:

             Summary: GridConnectionBytesVerifyFilter doesn't write magic header.
                 Key: IGNITE-1215
                 URL: https://issues.apache.org/jira/browse/IGNITE-1215
             Project: Ignite
          Issue Type: Bug
          Components: general
    Affects Versions: 1.1.4
            Reporter: Vladimir Ozerov
            Priority: Critical

GridConnectionBytesVerifyFilter performs magic header check on read, but do not add magic
header on write.

1) Open GridNioSelfTest class.
2) Add filter {code}new GridConnectionBytesVerifyFilter(log){code} in the serverBuilder()
3) Run testAsyncSendReceive() test and verify it fails.
4) Open GridConnectionBytesVerifyFilter class.
5) Add a field: 
private static final int MAGIC_WRITE_KEY  = GridNioSessionMetaKey.nextUniqueKey();
6) Change onSessionWriteMethod as follows:
/** {@inheritDoc} */
    @Override public GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg)
throws IgniteCheckedException {
        if (!ses.accepted() && ses.meta(MAGIC_WRITE_KEY) == null) {
            proceedSessionWrite(ses, ByteBuffer.wrap(U.IGNITE_HEADER)).get();

            ses.addMeta(MAGIC_WRITE_KEY, true);

        return proceedSessionWrite(ses, msg);
7) Re-run the test and verify that now it pass.

Proposed implementation plan:
1) Apply the fix approximately as described above, but with magic header being attached to
the passed buffer (not being sent as a separate message).
2) Review all usages of GridConnectionBytesVerifyFilter and remove manual magic header send
there. As I see it is only used in TcpCommunicationSpi.

This message was sent by Atlassian JIRA

View raw message