go-coap icon indicating copy to clipboard operation
go-coap copied to clipboard

Implement message retransmission of CON messages

Open jvermillard opened this issue 10 years ago • 2 comments

As specified in the RFC, confirmable message should be retransmitted until receiving an Acknowledgement with the same message ID

                        Client              Server
                           |                  |
                           |   CON [0x7d34]   |
                           +----------------->|
                           |                  |
                           |   ACK [0x7d34]   |
                           |<-----------------+
                           |                  | 

The sender retransmits the Confirmable message at exponentially increasing intervals, until it receives an acknowledgement (or Reset message) or runs out of attempts.

jvermillard avatar Mar 20 '15 19:03 jvermillard

My first idea is to do something like that: https://gist.github.com/jvermillard/344fb870e23922b31859 Use a goroutine per sent confirmable message for retransmitting if a timeout if reached. But it would introduce a "Server" object to store all the "in-flight" confirmable message WDYT?

jvermillard avatar Mar 25 '15 15:03 jvermillard

Seems pretty close. There's a bit of thread safety around s.inflight.

It seems that one might want a way to be aware of errors. Not sure what the best option is there. Callback or channel perhaps?

On Wed, Mar 25, 2015 at 8:05 AM Julien Vermillard [email protected] wrote:

My first idea is to do something like that: https://gist.github.com/jvermillard/344fb870e23922b31859 Use a goroutine per sent confirmable message for retransmitting if a timeout if reached. But it would introduce a "Server" object to store all the "in-flight" confirmable message WDYT?

— Reply to this email directly or view it on GitHub https://github.com/dustin/go-coap/issues/19#issuecomment-86071770.

dustin avatar Mar 26 '15 05:03 dustin