go-coap
go-coap copied to clipboard
Implement message retransmission of CON messages
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.
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?
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.