examples/coap-server.c: Re-order code (move fill_keystore) to support PKI

fill_keystore() now needs to be before coap_new_endpoint() is called.
This commit is contained in:
Jon Shallow committed 2018-02-12 11:58:59 +00:00
1 parent 82c9ccc75b
commit b2205d2e40
1 file changed
+2 -1
+2 -1
View File
@@ -349,6 +349,8 @@ get_context(const char *node, const char *port) {
if (!ctx) {
return NULL;
}
/* Need PSK set up before we set up (D)TLS endpoints */
fill_keystore(ctx);
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
@@ -526,7 +528,6 @@ main(int argc, char **argv) {
if (!ctx)
return -1;
fill_keystore(ctx);
init_resources(ctx);
/* join multicast group if requested at command line */