Commit Graph

1458 Commits

Author SHA1 Message Date
Ian Craggs 153dfd3a4a Remove non-windows code in test5 2020-08-05 15:31:05 +01:00
Ian Craggs 1475e9a281 Bump version number 2020-08-05 13:53:10 +01:00
Ian Craggs c89eb8fd6a Small test fix - premature free 2020-08-05 13:52:25 +01:00
Ian Craggs f0690b6298 Some fixes for test5 ws 2020-08-05 13:16:12 +01:00
Ian Craggs f9e23c3eb3 Windows compile error for LGTM recommendations 2020-08-03 17:17:58 +01:00
Ian Craggs 2ed54d3213 Address a couple of LGTM recommendations 2020-08-03 16:53:42 +01:00
Ian Craggs a312dafa24 Add some MQTT info to README 2020-08-03 16:24:24 +01:00
Ian Craggs edac13f765 Add header for #846 2020-08-03 16:23:54 +01:00
Ian Craggs ca6747c6dc Missing mask initializations 2020-08-03 15:58:02 +01:00
Ian Craggs e968aaf3cf Fix compile warnings in MQTTTime updates #927 2020-08-03 09:26:08 +01:00
Ian Craggs d736312164 Fix up elapsed time limitations on Windows #927 2020-08-02 23:53:17 +01:00
Ian Craggs 777a0ade0c Add more ws tests #865 2020-07-30 12:03:04 +01:00
Ian Craggs 99b71cdd5d Add websockets specific connect options initializers #724 2020-07-27 13:50:05 +01:00
Ian Craggs e2f4620ae4 Fix typo #919 2020-07-25 18:50:47 +01:00
Ian Craggs 86938878ef Add stdint header for Windows 2020-07-23 21:38:20 +01:00
Ian Craggs 52bc914287 Fix Windows build 2020-07-23 21:30:53 +01:00
Ian Craggs 9ab83100a8 Gather packet buffer data into a structure and record websocket mask used 2020-07-23 16:05:34 +01:00
Ian Craggs 9330ad0e2c Add some HTTP proxy trace messages 2020-07-13 12:35:14 +01:00
Ian Craggs 0fea6bbe22 Change default websockets port to 80 #544 2020-07-06 17:10:16 +01:00
Ian Craggs ac38fc98cd Add PAHO_HIGH_PERFORMANCE to the readme #914 2020-07-06 13:38:00 +01:00
Ian Craggs 6c26cfbf33 Merge branch 'develop' of github.com:eclipse/paho.mqtt.c into develop 2020-07-06 13:33:15 +01:00
Ian Craggs 88dcc6e16c MINGW definitions for websockets 2020-07-06 13:32:28 +01:00
Ian Craggs 6aec7bfbb5 For old builds of MacOS without CLOCK_REALTIME #546 2020-07-06 13:29:39 +01:00
Ian Craggs c09a00e43a Use only MQTT 3.1.1 against network test proxy 2020-07-03 11:10:07 +01:00
Ian Craggs 0982b2e042 Debug some test failures 2020-07-03 10:46:55 +01:00
Ian Craggs 09b582ebff More HA test fixes 2020-07-02 23:10:33 +01:00
Ian Craggs 5aaa25956f Clean up ha test 2020-07-02 17:40:45 +01:00
Ian Craggs 7465332c41 Error handling on socket error #916 2020-07-02 14:30:53 +01:00
Ian Craggs 04d81ce68e Report SSL errors properly #916 2020-07-02 12:34:50 +01:00
Ian Craggs 55096c080c Stop loop on socket close in Websockets #916 2020-07-01 20:05:16 +01:00
Ian Craggs 602f3047c7 Message queue sequence number wrap #745 2020-06-30 11:04:47 +01:00
Ian Craggs efd1c40dc2
Merge pull request #912 from KrzysztofC-RST/mqtt-on-ws-fixes
MQTT on WS fixes
2020-06-29 13:55:37 +01:00
Ian Craggs a240e26586 Wrap command sequence number #571 2020-06-29 13:08:22 +01:00
Ian Craggs 92ac88b167 Indicate SSL session has been freed #909 2020-06-29 11:00:34 +01:00
Ian Craggs fa160c08fc Remove inadvertent printStack call 2020-06-24 17:07:07 +01:00
kcieslinski d30d4c181d Remove unused bytes parameter from WebSocket_receiveFrame function
Signed-off-by: kcieslinski <krzysztof.cieslinski@rst.com.pl>
2020-06-19 08:50:17 +02:00
kcieslinski e07efe3e6e Ensure proper re-collecting MQTT frame from WS frame.
This fix ensure proper collecting MQTT frame from WS frame when previous attempt was interrupted at position > 0.

Signed-off-by: kcieslinski <krzysztof.cieslinski@rst.com.pl>
2020-06-19 08:41:27 +02:00
kcieslinski 55b58e1052 Ready for any part(s) of the MQTT frame(s) in WS frame(s).
Web Socket (WS) frame can contain any part of the MQTT frame(s).
in_frames (WS frames buffer) contain one or more WS frames data at a time.
i.e. WS starts NOT at the begin of a MQTT frame (begin part of the MQTT frame was in prevoius WS frame).
WS frame can contain many MQTT frames (or not even one) and may ends on MQTT frame NOT end.
This commit fixes possible deadlocks on receiving MQTT frame, loosing MQTT frames.

Signed-off-by: kcieslinski <krzysztof.cieslinski@rst.com.pl>
2020-06-19 07:54:47 +02:00
Ian Craggs c7a0079980 Protect thread start checks while allowing connect in a callback #698 2020-06-18 14:03:23 +01:00
Ian Craggs d55e1a28a9 Don't deliver messages before message arrived callback is set #610 2020-06-18 12:54:40 +01:00
Ian Craggs 77ab4743ca Free OpenSSL session #909 2020-06-18 12:19:51 +01:00
Ian Craggs aea8e6c32c
Merge pull request #908 from momobel/ssl_clear_error_queue
Clear OpenSSL errors before calling an OpenSSL TLS I/O operation
2020-06-16 15:45:40 +01:00
Ian Craggs ced9e40a8c Fix tests as part of #640 2020-06-10 22:47:59 +01:00
Ian Craggs 9fef662fa6 Some extra work for #640 - don't clean message queue on session present 0 2020-06-10 16:34:55 +01:00
Mohamed Belaouad d0db327248 Clear OpenSSL errors before calling an OpenSSL TLS I/O operation
For some reasons OpenSSL may return an error when an I/O operation is called.
SSL_get_error is then called to get the reason of the error.
An SSL_ERROR_SSL (1) is returned which triggers a disconnect.
The application would reconnect succesfully with CONNECT+CONNACK but further messages would fail with the same SSL error.
This whole process would repeat indefinitely with continuous disconnection and reconnection.

It seems to be because SSL_get_error requires the error queue to be empty before a TLS I/O operation is performed (see https://www.openssl.org/docs/man1.1.1/man3/SSL_get_error.html)

Use ERR_clear_error before each call to OpenSSL TLS I/O to clear the error queue.

Logs:

20200604 133348.670 (1911096336)  (1)> MQTTAsync_processCommand:1398
20200604 133348.670 (1911096336)   (2)> MQTTProtocol_startPublish:156
20200604 133348.670 (1911096336)    (3)> MQTTProtocol_createMessage:186
20200604 133348.670 (1911096336)     (4)> MQTTProtocol_storePublication:224
20200604 133348.673 (1911096336)     (4)< MQTTProtocol_storePublication:245
20200604 133348.673 (1911096336)    (3)< MQTTProtocol_createMessage:209
20200604 133348.673 (1911096336)    (3)> MQTTProtocol_startPublishCommon:133
20200604 133348.673 (1911096336)     (4)> MQTTPacket_send_publish:800
20200604 133348.673 (1911096336)      (5)> MQTTPacket_sends:239
20200604 133348.673 (1911096336)       (6)> MQTTPacket_encode:281
20200604 133348.673 (1911096336)       (6)< MQTTPacket_encode:291 (2)
20200604 133348.673 (1911096336)       (6)> MQTTPersistence_put:405
20200604 133348.673 (1911096336)       (6)< MQTTPersistence_put:456 (0)
20200604 133348.673 (1911096336)       (6)> WebSocket_putdatas:782
20200604 133348.673 (1911096336)        (7)> SSLSocket_putdatas:936
20200604 133348.673 sent 0 256 buflen 5
20200604 133348.673 (1911096336)         (8)> SSLSocket_error:100
20200604 133348.673 SSLSocket error (1) in SSL_write for socket 9 rc -1 errno 2 No such file or directory
20200604 133348.673 (1911096336)         (8)< SSLSocket_error:120 (-3)
20200604 133348.673 (1911096336)        (7)< SSLSocket_putdatas:990 (-1)
20200604 133348.673 (1911096336)       (6)< WebSocket_putdatas:814 (-1)
20200604 133348.673 (1911096336)      (5)< MQTTPacket_sends:266 (-1)
20200604 133348.673 9 3a4c0898cb83330e -> PUBLISH msgid: 8 qos: 1 retained: 0 (-1) payload: [{"propertyId":"rzQp
20200604 133348.673 (1911096336)     (4)< MQTTPacket_send_publish:844 (-1)
20200604 133348.676 (1911096336)    (3)< MQTTProtocol_startPublishCommon:137 (-1)
20200604 133348.676 (1911096336)   (2)< MQTTProtocol_startPublish:169 (-1)
20200604 133348.676 (1911096336)   (2)> MQTTAsync_disconnect1:3130
20200604 133348.676 (1911096336)    (3)> MQTTAsync_addCommand:1050
20200604 133348.676 (1911096336)     (4)> Thread_signal_cond:395
20200604 133348.676 (1911096336)     (4)< Thread_signal_cond:400 (0)
20200604 133348.676 (1911096336)    (3)< MQTTAsync_addCommand:1084 (0)
20200604 133348.676 (1911096336)   (2)< MQTTAsync_disconnect1:3167 (0)
20200604 133348.676 Calling command failure for client 3a4c0898cb83330e
20200604 133348.676 (1911096336)   (2)> MQTTProperties_free:366
20200604 133348.676 (1911096336)   (2)< MQTTProperties_free:389
20200604 133348.676 (1911096336)  (1)< MQTTAsync_processCommand:1734 (1)
20200604 133348.676 (1911096336)  (1)> MQTTAsync_processCommand:1398
20200604 133348.676 (1911096336)   (2)> MQTTAsync_checkDisconnect:1154
20200604 133348.676 (1911096336)    (3)> MQTTAsync_closeSession:2661
20200604 133348.676 (1911096336)     (4)> MQTTAsync_closeOnly:2633
20200604 133348.676 (1911096336)      (5)> MQTTProtocol_checkPendingWrites:1208
20200604 133348.676 (1911096336)      (5)< MQTTProtocol_checkPendingWrites:1225
20200604 133348.676 (1911096336)      (5)> MQTTPacket_send_disconnect:488
20200604 133348.676 (1911096336)       (6)> MQTTPacket_send:187
20200604 133348.678 (1911096336)        (7)> MQTTPacket_encode:281
20200604 133348.678 (1911096336)        (7)< MQTTPacket_encode:291 (1)
20200604 133348.678 (1911096336)        (7)> WebSocket_putdatas:782
20200604 133348.678 (1911096336)         (8)> SSLSocket_putdatas:936
20200604 133348.678 (1911096336)          (9)> SSLSocket_error:100
20200604 133348.678 SSLSocket error (1) in SSL_write for socket 9 rc -1 errno 2 No such file or directory

Signed-off-by: Mohamed Belaouad <mohamed.belaouad@wattsense.com>
2020-06-09 10:03:45 +02:00
Ian Craggs 97f469eee4 Don't remove queued messages on state cleanup #640 2020-06-08 16:14:50 +01:00
Ian Craggs f0d05ad658 Add warning about linking with TLS enabled for ssl/wss uri prefixes #899 2020-06-08 12:46:56 +01:00
Ian Craggs bf688464c8 Merge branch 'master' into develop 2020-06-04 17:59:47 +01:00
Ian Craggs 8d3d8276a7 Switch build artifact transmission back to tags only 2020-06-04 17:58:51 +01:00
Ian Craggs c7834ace6c Try to get builds pushed to Github 2020-06-04 16:39:48 +01:00