42
42
#undef WOLFMQTT_DEBUG_SOCKET
43
43
#endif
44
44
45
- /* #define WOLFMQTT_TEST_NONBLOCK */
46
- #ifdef WOLFMQTT_TEST_NONBLOCK
47
- #define WOLFMQTT_TEST_NONBLOCK_TIMES 1
48
- #endif
49
-
50
45
/* lwip */
51
46
#ifdef WOLFSSL_LWIP
52
47
#undef read
@@ -64,18 +59,6 @@ int MqttSocket_TlsSocketReceive(WOLFSSL* ssl, char *buf, int sz,
64
59
MqttClient * client = (MqttClient * )ptr ;
65
60
(void )ssl ; /* Not used */
66
61
67
- #if defined(WOLFMQTT_NONBLOCK ) && defined(WOLFMQTT_TEST_NONBLOCK )
68
- static int testSmallerTlsRead = 0 ;
69
- if (!testSmallerTlsRead ) {
70
- if (sz > 2 )
71
- sz /= 2 ;
72
- testSmallerTlsRead = 1 ;
73
- }
74
- else {
75
- testSmallerTlsRead = 0 ;
76
- }
77
- #endif
78
-
79
62
rc = client -> net -> read (client -> net -> context , (byte * )buf , sz ,
80
63
client -> tls .timeout_ms );
81
64
@@ -99,18 +82,6 @@ int MqttSocket_TlsSocketSend(WOLFSSL* ssl, char *buf, int sz,
99
82
MqttClient * client = (MqttClient * )ptr ;
100
83
(void )ssl ; /* Not used */
101
84
102
- #if defined(WOLFMQTT_NONBLOCK ) && defined(WOLFMQTT_TEST_NONBLOCK )
103
- static int testSmallerTlsWrite = 0 ;
104
- if (!testSmallerTlsWrite ) {
105
- if (sz > 2 )
106
- sz /= 2 ;
107
- testSmallerTlsWrite = 1 ;
108
- }
109
- else {
110
- testSmallerTlsWrite = 0 ;
111
- }
112
- #endif
113
-
114
85
rc = client -> net -> write (client -> net -> context , (byte * )buf , sz ,
115
86
client -> tls .timeout_ms );
116
87
@@ -153,15 +124,6 @@ static int MqttSocket_WriteDo(MqttClient *client, const byte* buf, int buf_len,
153
124
{
154
125
int rc ;
155
126
156
- #if defined(WOLFMQTT_NONBLOCK ) && defined(WOLFMQTT_TEST_NONBLOCK )
157
- static int testNbWriteAlt = 0 ;
158
- if (testNbWriteAlt < WOLFMQTT_TEST_NONBLOCK_TIMES ) {
159
- testNbWriteAlt ++ ;
160
- return MQTT_CODE_CONTINUE ;
161
- }
162
- testNbWriteAlt = 0 ;
163
- #endif
164
-
165
127
#ifdef ENABLE_MQTT_TLS
166
128
if (MqttClient_Flags (client ,0 ,0 ) & MQTT_CLIENT_FLAG_IS_TLS ) {
167
129
client -> tls .timeout_ms = timeout_ms ;
@@ -194,18 +156,6 @@ static int MqttSocket_WriteDo(MqttClient *client, const byte* buf, int buf_len,
194
156
else
195
157
#endif /* ENABLE_MQTT_TLS */
196
158
{
197
- #if defined(WOLFMQTT_NONBLOCK ) && defined(WOLFMQTT_TEST_NONBLOCK )
198
- static int testSmallerWrite = 0 ;
199
- if (!testSmallerWrite ) {
200
- if (buf_len > 2 )
201
- buf_len /= 2 ;
202
- testSmallerWrite = 1 ;
203
- }
204
- else {
205
- testSmallerWrite = 0 ;
206
- }
207
- #endif
208
-
209
159
rc = client -> net -> write (client -> net -> context , buf , buf_len ,
210
160
timeout_ms );
211
161
}
@@ -276,15 +226,6 @@ static int MqttSocket_ReadDo(MqttClient *client, byte* buf, int buf_len,
276
226
{
277
227
int rc ;
278
228
279
- #if defined(WOLFMQTT_NONBLOCK ) && defined(WOLFMQTT_TEST_NONBLOCK )
280
- static int testNbReadAlt = 0 ;
281
- if (testNbReadAlt < WOLFMQTT_TEST_NONBLOCK_TIMES ) {
282
- testNbReadAlt ++ ;
283
- return MQTT_CODE_CONTINUE ;
284
- }
285
- testNbReadAlt = 0 ;
286
- #endif
287
-
288
229
#ifdef ENABLE_MQTT_TLS
289
230
if (MqttClient_Flags (client ,0 ,0 ) & MQTT_CLIENT_FLAG_IS_TLS ) {
290
231
client -> tls .timeout_ms = timeout_ms ;
@@ -320,17 +261,6 @@ static int MqttSocket_ReadDo(MqttClient *client, byte* buf, int buf_len,
320
261
else
321
262
#endif /* ENABLE_MQTT_TLS */
322
263
{
323
- #if defined(WOLFMQTT_NONBLOCK ) && defined(WOLFMQTT_TEST_NONBLOCK )
324
- static int testSmallerRead = 0 ;
325
- if (!testSmallerRead ) {
326
- if (buf_len > 2 )
327
- buf_len /= 2 ;
328
- testSmallerRead = 1 ;
329
- }
330
- else {
331
- testSmallerRead = 0 ;
332
- }
333
- #endif
334
264
rc = client -> net -> read (client -> net -> context , buf , buf_len , timeout_ms );
335
265
}
336
266
0 commit comments