Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.

Simultaneous requests to the same server overwrites each other's handshaker #29

Open
yunus opened this issue Dec 16, 2014 · 1 comment

Comments

@yunus
Copy link

yunus commented Dec 16, 2014

In my project I delay the flight 6 (server finished message) from the TinyDTLS constrained server. While, scandium is re-transmitting the flight 5 as it is supposed to do, from upper layer a new request arrives. In sendNext@DTLSConnector, since there is already a session, which is not active, a new ResumingClientHandshaker (RCH) is created. RCH overwrites the existing ClientHandshaker. The rest is disaster.

For the time being, in the sendNext method I simply ignore requests while there is already an ongoing flight. I am not sure what is the true action. May be the problem is the upper layer since it re-sends the request although I use blocking Coap interface as follows:

        CoapClient client = new CoapClient(uri);
            client.setEndpoint(new CoAPEndpoint(dtlsConnector, NetworkConfig.getStandard()));
            client.setTimeout(0);
            CoapResponse response = client.get();
@yunus yunus changed the title Client re-transmits an expired flight (i.e., flight 5 ) with ResumingClientHandshaker instead of ClientHandshaker Simultaneous requests to the same server overwrites each other's handshaker Jan 10, 2015
@sophokles73
Copy link
Contributor

@yunus,

I have been thinking about how we should address this problem for a while. I think, we could introduce an outbound message queue for each (outbound) Handshaker with limited capacity (e.g. 20 messages?). The Handshakers' contstructor currenly allows for the submission of a single message that is to be sent when the session has been established. Thus, we would simply extend this concept to support multiple messages being sent once the session has been established.

For an outbound message we can then determine if a handshake is already in progress with the target server and if so, simply add the message to the Handshaker's (outbound) queue.

However, this can only work for scenarios, where the frequency of messages to be sent to the server is somewhat limited, i.e. this only works if the outbound message queue's capacity is not exhausted immediately ...

What do you think? Would this work for you?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants