mirror of https://github.com/eclipse/paho.mqtt.c
Update sample to utilize SSL error callback function
Signed-off-by: tbeu <tc@tbeu.de>
This commit is contained in:
parent
98cd807b63
commit
7a43da5ca1
|
|
@ -206,6 +206,13 @@ void onPublish(void* context, MQTTAsync_successData* response)
|
|||
}
|
||||
|
||||
|
||||
static int onSSLError(const char *str, size_t len, void *context)
|
||||
{
|
||||
MQTTAsync client = (MQTTAsync)context;
|
||||
return fprintf(stderr, "SSL error: %s\n", str);
|
||||
}
|
||||
|
||||
|
||||
void myconnect(MQTTAsync client)
|
||||
{
|
||||
MQTTAsync_connectOptions conn_opts = MQTTAsync_connectOptions_initializer;
|
||||
|
|
@ -256,6 +263,8 @@ void myconnect(MQTTAsync client)
|
|||
ssl_opts.privateKey = opts.key;
|
||||
ssl_opts.privateKeyPassword = opts.keypass;
|
||||
ssl_opts.enabledCipherSuites = opts.ciphers;
|
||||
ssl_opts.ssl_error_cb = onSSLError;
|
||||
ssl_opts.ssl_error_context = client;
|
||||
conn_opts.ssl = &ssl_opts;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue