Config constructor

Config({
  1. String label = '',
  2. bool flood = false,
  3. bool public = false,
  4. int serverPort = 52000,
  5. int expiryTime = 10,
  6. int validityPeriod = 7200,
  7. int validityCheck = 7200,
})

Creates a Config object.

If label is given, it is used as the unique identifier of the device. Otherwise, a random UUID is generated.

If flood is set to true, then internal flooding mechanisms are activated, e.g., flood new connection events.

If public is set to true, then the current device will always join the first group formation message received.

If serverPort is given, then it is used instead of the default one (52000). The port number should be exclusively bewteen 1023 and 65535. Otherwise, a BadServerPortException exception is thrown.

If expiryTime is given, then it is used instead of the default one (10 seconds).

If validityPeriod is given, then it is used instead of the default one (7200 seconds).

If validityCheck is given, then it is used instead of the default one (7200 seconds).

Implementation

Config(
    {String label = '',
    bool flood = false,
    bool public = false,
    int serverPort = 52000,
    int expiryTime = 10,
    int validityPeriod = 7200,
    int validityCheck = 7200}) {
  this.label = (label == '') ? Uuid().v4() : label;
  this.flood = flood;
  this.public = public;
  this.serverPort = serverPort;
  this.expiryTime = expiryTime;
  this.validityPeriod = validityPeriod;
  this.validityCheck = validityCheck;
  timeOut = 5000;
}