Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 1x 1x 1x 6x 29x 29x 6x 6x 6x 6x 6x 6x 6x 1x 1x 3x 1x | 'use strict'
/*
* Copyright (c) 2013-2021 node-coap contributors.
*
* node-coap is licensed under an MIT +no-false-attribs license.
* All rights not explicitly granted in the MIT license are reserved.
* See the included LICENSE file for more details.
*/
// CoAP parameters
var p = {
ackTimeout: 2 // seconds
, ackRandomFactor: 1.5
, maxRetransmit: 4
// MAX_LATENCY is the maximum time a datagram is expected to take
// from the start of its transmission to the completion of its
// reception.
, maxLatency: 100 // seconds
, piggybackReplyMs: 50
// default coap port
, coapPort: 5683
// default max packet size
, maxPacketSize: 1280
// true: always send CoAP ACK messages, even for non confirmabe packets
// false: only send CoAP ACK messages for confirmabe packets
, sendAcksForNonConfirmablePackets: true
}
var defaultTiming = JSON.parse(JSON.stringify(p))
p.refreshTiming = function(values) {
for (var key in values){
Eif (p[key]) {
p[key] = values[key]
}
}
// MAX_TRANSMIT_SPAN is the maximum time from the first transmission
// of a Confirmable message to its last retransmission.
p.maxTransmitSpan = p.ackTimeout * ((Math.pow(2, p.maxRetransmit)) - 1) * p.ackRandomFactor
// MAX_TRANSMIT_WAIT is the maximum time from the first transmission
// of a Confirmable message to the time when the sender gives up on
// receiving an acknowledgement or reset.
p.maxTransmitWait = p.ackTimeout * (Math.pow(2, p.maxRetransmit + 1) - 1) * p.ackRandomFactor
// PROCESSING_DELAY is the time a node takes to turn around a
// Confirmable message into an acknowledgement.
p.processingDelay = p.ackTimeout
// MAX_RTT is the maximum round-trip time
p.maxRTT = 2 * p.maxLatency + p.processingDelay
// EXCHANGE_LIFETIME is the time from starting to send a Confirmable
// message to the time when an acknowledgement is no longer expected,
// i.e. message layer information about the message exchange can be
// purged
p.exchangeLifetime = p.maxTransmitSpan + p.maxRTT
// LRU prune timer period.
// In order to reduce unnecessary heap usage on low-traffic servers the
// LRU cache is periodically pruned to remove old, expired packets. This
// is a fairly low-intensity task, but the period can be altered here
// or the timer disabled by setting the value to zero.
// By default the value is set to 0.5 x exchangeLifetime (~120s)
Iif (values && (typeof(values.pruneTimerPeriod)==="number")) {
p.pruneTimerPeriod = values.pruneTimerPeriod
} else {
p.pruneTimerPeriod = (0.5 * p.exchangeLifetime)
}
}
p.refreshTiming()
p.defaultTiming = function() {
p.refreshTiming(defaultTiming)
}
module.exports = p
|