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

add support for 2.2 (new unified request protocol) #49

Closed
rajatm opened this issue Mar 9, 2011 · 1 comment
Closed

add support for 2.2 (new unified request protocol) #49

rajatm opened this issue Mar 9, 2011 · 1 comment

Comments

@rajatm
Copy link

rajatm commented Mar 9, 2011

Can the support for latest redis release 2.2.2 be added?

I have modified the code in ProtocolBase to support the new unified request protocol http://redis.io/topics/protocol by just replacing the method createRequest by following:

public Request createRequest(Command cmd, byte[]... args) throws ProviderException, IllegalArgumentException {

    ByteArrayOutputStream buffer = createRequestBufffer (cmd);

    try {
        int argsCount = 1;
        if(args != null) {
            argsCount += args.length;
        }
        buffer.write(COUNT_BYTE);
        buffer.write(Convert.toBytes(argsCount));
        buffer.write(CRLF);

        buffer.write(SIZE_BYTE);
        buffer.write(Convert.toBytes(cmd.bytes.length));
        buffer.write(CRLF);
        buffer.write(cmd.bytes);
        buffer.write(CRLF);

        for(int s=0; s<args.length; s++){
            buffer.write(SIZE_BYTE);
            buffer.write(Convert.toBytes(args[s].length));
            buffer.write(CRLF);
            buffer.write(args[s]);
            buffer.write(CRLF);
        }
    } catch (Exception e) {
        throw new ProviderException("Problem writing to the buffer" + e.getLocalizedMessage());
    }
    return createRequest(buffer);
}

As of now it seems to be working fine at least for Synch Connection. Please check and incorporate if fine.

@alphazero
Copy link
Owner

Give the trunk another try. Its up to Redsi 2.2.4

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

No branches or pull requests

2 participants