Skip to content

Commit

Permalink
[Tradfri] Force session resume after communication errors
Browse files Browse the repository at this point in the history
As discussed in eclipse-archived/smarthome#6065 the tradfri gateway does not support a session resumption after a gateway reboot or other communcation errors.
Californium 1.0.7 is able to force a full handshake instead.
This change calls "forceResumeSessionFor" after a communication error, so that a full handshake is done.

Signed-off-by: Holger Reichert <[email protected]>
  • Loading branch information
hreichert committed Jan 30, 2019
1 parent 14dce31 commit d6b10c2
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,15 @@ private synchronized void requestDeviceDetails(String instanceId) {

@Override
public void setStatus(ThingStatus status, ThingStatusDetail statusDetail) {

// to fix connection issues after a gateway reboot, a session resume is forced for the next command
if (status == ThingStatus.OFFLINE && statusDetail == ThingStatusDetail.COMMUNICATION_ERROR) {
logger.debug("Gateway communication error. Forcing session resume on next command.");
TradfriGatewayConfig configuration = getConfigAs(TradfriGatewayConfig.class);
InetSocketAddress peerAddress = new InetSocketAddress(configuration.host, configuration.port);
this.dtlsConnector.forceResumeSessionFor(peerAddress);
}

// are we still connected at all?
if (endPoint != null) {
updateStatus(status, statusDetail);
Expand Down

0 comments on commit d6b10c2

Please sign in to comment.