Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function CoapShepherd(config) {
EventEmitter.call(this);
this.clientIdCount = 1;
this._setConfig(config);
this._net = {
intf: '',
ip: this._config.ip,
port: this._config.port,
mac: '',
routerIp: ''
};
this._agent = coap.globalAgent;
this._registry = {};
this._server = null;
this._enabled = false;
this._joinable = false;
this._hbChecker = null;
this._permitJoinTime = 0;
this._permitJoinTimer = null;
coap.updateTiming({
maxLatency: (this._config.reqTimeout - 47) / 2
});
this._acceptDevIncoming = function (devInfo, callback) { // Override at will.
setImmediate(function () {
var accepted = true;
});
if (shepherd._config.connectionType === 'udp6') {
coap.globalAgentIPv6 = new coap.Agent({
type: shepherd._config.connectionType,
socket: server._sock
});
shepherd._agent = coap.globalAgentIPv6;
} else {
coap.globalAgent = new coap.Agent({
type: shepherd._config.connectionType,
socket: server._sock
});
shepherd._agent = coap.globalAgent;
}
return deferred.promise.nodeify(callback);
};