mirror of
https://github.com/deavmi/doap
synced 2024-07-04 15:30:09 +02:00
CoapClient
- Implemented `newMid()` to provide a unique new mid
This commit is contained in:
parent
4c788b91c3
commit
d6eefb3a9b
|
@ -74,6 +74,22 @@ public class CoapClient
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
package ulong newMid()
|
||||||
|
{
|
||||||
|
ulong newValue;
|
||||||
|
|
||||||
|
// Lock rolling counter
|
||||||
|
this.rollingLock.lock();
|
||||||
|
|
||||||
|
newValue = this.rollingMid;
|
||||||
|
this.rollingMid++;
|
||||||
|
|
||||||
|
// Unlock rolling counter
|
||||||
|
this.rollingLock.unlock();
|
||||||
|
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new CoAP client to the
|
* Constructs a new CoAP client to the
|
||||||
* provided endpoint address and port.
|
* provided endpoint address and port.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user