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

two messages simultaneously #3

Open
Khatskevich opened this issue Apr 17, 2016 · 2 comments
Open

two messages simultaneously #3

Khatskevich opened this issue Apr 17, 2016 · 2 comments

Comments

@Khatskevich
Copy link

it seems that if two messages comes simultaneously, then problems there may occure:
HttpMessageReader:read:int endIndex = HttpUtil.parseHttpRequest(...
I think "for loop" need there.

@jjenkov
Copy link
Owner

jjenkov commented Apr 18, 2016

That is very possible. The HTTP message reader functionality is not very well tested. It is only there to briefly show how a message reader could be made.

This design has been used as base for an IAP platform (IAP is a new network protocol - alternative to HTTP). This server can receive hundreds of thousands of messages per second without any problems. So - the over all design works, even if this current implementation might have some problems with HTTP messages.

@carl-don-it
Copy link

and with more than one message , there is still a problem in com.jenkov.nioserver.MessageWriter#write
bytesWritten is connected with one message , needed to be set to zero once message is all send

        if(bytesWritten >= this.messageInProgress.length){
            if(this.writeQueue.size() > 0){
                this.messageInProgress = this.writeQueue.remove(0);
            } else {
                this.messageInProgress = null;
                //todo unregister from selector
            }
            // bytesWritten need to be set to zero
            bytesWritten = 0;
        }

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

3 participants