@@ -90,11 +90,11 @@ const errors = {
90
90
162 : 'Wildcard Subscriptions not supported'
91
91
}
92
92
93
- function defaultId ( ) {
93
+ function defaultId ( ) {
94
94
return 'mqttjs_' + Math . random ( ) . toString ( 16 ) . substr ( 2 , 8 )
95
95
}
96
96
97
- function applyTopicAlias ( client , packet ) {
97
+ function applyTopicAlias ( client , packet ) {
98
98
if ( client . options . protocolVersion === 5 ) {
99
99
if ( packet . cmd === 'publish' ) {
100
100
let alias
@@ -144,7 +144,7 @@ function applyTopicAlias(client, packet) {
144
144
}
145
145
}
146
146
147
- function removeTopicAliasAndRecoverTopicName ( client , packet ) {
147
+ function removeTopicAliasAndRecoverTopicName ( client , packet ) {
148
148
let alias
149
149
if ( packet . properties ) {
150
150
alias = packet . properties . topicAlias
@@ -169,7 +169,7 @@ function removeTopicAliasAndRecoverTopicName(client, packet) {
169
169
}
170
170
}
171
171
172
- function sendPacket ( client , packet , cb ) {
172
+ function sendPacket ( client , packet , cb ) {
173
173
debug ( 'sendPacket :: packet: %O' , packet )
174
174
debug ( 'sendPacket :: emitting `packetsend`' )
175
175
@@ -187,7 +187,7 @@ function sendPacket(client, packet, cb) {
187
187
}
188
188
}
189
189
190
- function flush ( queue ) {
190
+ function flush ( queue ) {
191
191
if ( queue ) {
192
192
debug ( 'flush: queue exists? %b' , ! ! ( queue ) )
193
193
Object . keys ( queue ) . forEach ( function ( messageId ) {
@@ -201,7 +201,7 @@ function flush(queue) {
201
201
}
202
202
}
203
203
204
- function flushVolatile ( queue ) {
204
+ function flushVolatile ( queue ) {
205
205
if ( queue ) {
206
206
debug ( 'flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function' )
207
207
Object . keys ( queue ) . forEach ( function ( messageId ) {
@@ -213,7 +213,7 @@ function flushVolatile(queue) {
213
213
}
214
214
}
215
215
216
- function storeAndSend ( client , packet , cb , cbStorePut ) {
216
+ function storeAndSend ( client , packet , cb , cbStorePut ) {
217
217
debug ( 'storeAndSend :: store packet with cmd %s to outgoingStore' , packet . cmd )
218
218
let storePacket = packet
219
219
let err
@@ -227,7 +227,7 @@ function storeAndSend(client, packet, cb, cbStorePut) {
227
227
return cb && cb ( err )
228
228
}
229
229
}
230
- client . outgoingStore . put ( storePacket , function storedPacket ( err ) {
230
+ client . outgoingStore . put ( storePacket , function storedPacket ( err ) {
231
231
if ( err ) {
232
232
return cb && cb ( err )
233
233
}
@@ -236,7 +236,7 @@ function storeAndSend(client, packet, cb, cbStorePut) {
236
236
} )
237
237
}
238
238
239
- function nop ( error ) {
239
+ function nop ( error ) {
240
240
debug ( 'nop ::' , error )
241
241
}
242
242
@@ -247,7 +247,7 @@ function nop(error) {
247
247
* @param {Object } [options] - connection options
248
248
* (see Connection#connect)
249
249
*/
250
- function MqttClient ( streamBuilder , options ) {
250
+ function MqttClient ( streamBuilder , options ) {
251
251
let k
252
252
const that = this
253
253
@@ -339,7 +339,7 @@ function MqttClient(streamBuilder, options) {
339
339
this . on ( 'connect' , function ( ) {
340
340
const queue = that . queue
341
341
342
- function deliver ( ) {
342
+ function deliver ( ) {
343
343
const entry = queue . shift ( )
344
344
debug ( 'deliver :: entry %o' , entry )
345
345
let packet = null
@@ -427,7 +427,7 @@ MqttClient.prototype._setupStream = function () {
427
427
packets . push ( packet )
428
428
} )
429
429
430
- function nextTickWork ( ) {
430
+ function nextTickWork ( ) {
431
431
if ( packets . length ) {
432
432
nextTick ( work )
433
433
} else {
@@ -437,7 +437,7 @@ MqttClient.prototype._setupStream = function () {
437
437
}
438
438
}
439
439
440
- function work ( ) {
440
+ function work ( ) {
441
441
debug ( 'work :: getting next packet in queue' )
442
442
const packet = packets . shift ( )
443
443
@@ -460,7 +460,7 @@ MqttClient.prototype._setupStream = function () {
460
460
work ( )
461
461
}
462
462
463
- function streamErrorHandler ( error ) {
463
+ function streamErrorHandler ( error ) {
464
464
debug ( 'streamErrorHandler :: error' , error . message )
465
465
if ( socketErrors . includes ( error . code ) ) {
466
466
// handle error
@@ -989,7 +989,7 @@ MqttClient.prototype.end = function (force, opts, cb) {
989
989
debug ( 'end :: cb? %s' , ! ! cb )
990
990
cb = cb || nop
991
991
992
- function closeStores ( ) {
992
+ function closeStores ( ) {
993
993
debug ( 'end :: closeStores: closing incoming and outgoing stores' )
994
994
that . disconnected = true
995
995
that . incomingStore . close ( function ( e1 ) {
@@ -1008,7 +1008,7 @@ MqttClient.prototype.end = function (force, opts, cb) {
1008
1008
}
1009
1009
}
1010
1010
1011
- function finish ( ) {
1011
+ function finish ( ) {
1012
1012
// defer closesStores of an I/O cycle,
1013
1013
// just to make sure things are
1014
1014
// ok for websockets
@@ -1797,10 +1797,10 @@ MqttClient.prototype._onConnect = function (packet) {
1797
1797
1798
1798
this . connected = true
1799
1799
1800
- function startStreamProcess ( ) {
1800
+ function startStreamProcess ( ) {
1801
1801
let outStore = that . outgoingStore . createStream ( )
1802
1802
1803
- function clearStoreProcessing ( ) {
1803
+ function clearStoreProcessing ( ) {
1804
1804
that . _storeProcessing = false
1805
1805
that . _packetIdsDuringStoreProcessing = { }
1806
1806
}
@@ -1813,14 +1813,14 @@ MqttClient.prototype._onConnect = function (packet) {
1813
1813
that . emit ( 'error' , err )
1814
1814
} )
1815
1815
1816
- function remove ( ) {
1816
+ function remove ( ) {
1817
1817
outStore . destroy ( )
1818
1818
outStore = null
1819
1819
that . _flushStoreProcessingQueue ( )
1820
1820
clearStoreProcessing ( )
1821
1821
}
1822
1822
1823
- function storeDeliver ( ) {
1823
+ function storeDeliver ( ) {
1824
1824
// edge case, we wrapped this twice
1825
1825
if ( ! outStore ) {
1826
1826
return
0 commit comments