Closed kulak closed 9 years ago
The fix in discovery route handler should be:
ack := ContentMessage(msg.MessageId, TYPE_ACKNOWLEDGEMENT)
ack.Token = make([]byte, len(msg.Token))
copy(ack.Token, msg.Token)
I am sorry, I can't contribute to the code base in a meaningful way until I get approval.
ah yes you're right. i'll put your fix in there.
just out of curiousity, what sort of approval are you referring to? to do a pull request?
I assume it is fixed and I will close the issue. I have moved to https://github.com/dustin/go-coap project as it appears to have heavy backing.
The output has been modified and does not match currently checked-in code. For example, token is printed using "% x" format.
Received bytes: 44 01 1a bf 78 6d f2 d7 bb 2e 77 65 6c 6c 2d 6b 6e 6f 77 6e 04 63 6f 72 65 10
2015/09/23 10:27:23 = = = = = = = = = = = = = = = = 2015/09/23 10:27:23 Code: 1, 1 2015/09/23 10:27:23 Code String: GET 2015/09/23 10:27:23 MessageId: 6847, 1abf 2015/09/23 10:27:23 MessageType: 0, 0 2015/09/23 10:27:23 Token: 78 6d f2 d7 2015/09/23 10:27:23 Token Length: 4 2015/09/23 10:27:23 Payload str: 2015/09/23 10:27:23 Payload hex: 2015/09/23 10:27:23 - - - OPTIONS - - - 2015/09/23 10:27:23 Code/Number: 11 , Name: Uri-Path , Value: .well-known 2015/09/23 10:27:23 Code/Number: 11 , Name: Uri-Path , Value: core 2015/09/23 10:27:23 Code/Number: 12 , Name: Content-Format , Value:
2015/09/23 10:27:23 = = = = = = = = = = = = = = = =
Library generates response and it is clear that Token is not included. I believe that according to spec section "5.3.2 Request/Response Matching Rules" response token must match request token.
2015/09/23 10:27:23 = = = = = = = = = = = = = = = = 2015/09/23 10:27:23 Code: 69, 45 2015/09/23 10:27:23 Code String: 205 Content 2015/09/23 10:27:23 MessageId: 6847, 1abf 2015/09/23 10:27:23 MessageType: 2, 2 2015/09/23 10:27:23 Token: 2015/09/23 10:27:23 Token Length: 0 2015/09/23 10:27:23 Payload str: <//hello>,<//hello>,<//basic>,<//basic/json>,<//basic/xml>,<//.well-known/core>, 2015/09/23 10:27:23 Payload hex: 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 62 61 73 69 63 3e 2c 3c 2f 2f 62 61 73 69 63 2f 6a 73 6f 6e 3e 2c 3c 2f 2f 62 61 73 69 63 2f 78 6d 6c 3e 2c 3c 2f 2f 2e 77 65 6c 6c 2d 6b 6e 6f 77 6e 2f 63 6f 72 65 3e 2c 2015/09/23 10:27:23 - - - OPTIONS - - - 2015/09/23 10:27:23 Code/Number: 12 , Name: Content-Format , Value: 40 2015/09/23 10:27:23 = = = = = = = = = = = = = = = = 2015/09/23 10:27:23 Response bytes: 60 45 1a bf c1 28 ff 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 68 65 6c 6c 6f 3e 2c 3c 2f 2f 62 61 73 69 63 3e 2c 3c 2f 2f 62 61 73 69 63 2f 6a 73 6f 6e 3e 2c 3c 2f 2f 62 61 73 69 63 2f 78 6d 6c 3e 2c 3c 2f 2f 2e 77 65 6c 6c 2d 6b 6e 6f 77 6e 2f 63 6f 72 65 3e 2c