Skip to content

Commit

Permalink
[Tradfri] Force session resume after communication errors (#4764)
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 <mail@h0lger.de>
  • Loading branch information
hreichert authored and cweitkamp committed Feb 1, 2019
1 parent dffa2c6 commit 539cb6f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@ 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 539cb6f

Please sign in to comment.