Skip to content

Commit

Permalink
Remove ObserveRelation also on early cancel.
Browse files Browse the repository at this point in the history
Fix javadoc.

Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
  • Loading branch information
boaks committed Mar 3, 2024
1 parent 7ef56fe commit 7e35e62
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Expand Up @@ -51,7 +51,7 @@ public class ObserveManager {
/** The mapping from endpoint addresses to ObservingEndpoints */
private final ConcurrentHashMap<InetSocketAddress, ObservingEndpoint> endpoints;
/**
* The mapping from endpoint addresses to ObservingEndpoints.
* The mapping from token/endpoint address pairs to ObserveRelations.
*
* @since 3.6
*/
Expand Down
Expand Up @@ -425,7 +425,8 @@ public State onResponse(Response response) {
return State.ESTABILSHED;
} else {
boolean established = false;
if (response.isSuccess()) {
boolean add = response.isSuccess();
if (add) {
setEstablished();
resource.addObserveRelation(this);
established = !isCanceled();
Expand All @@ -436,6 +437,9 @@ public State onResponse(Response response) {
}
return State.INIT;
} else {
if (add) {
resource.removeObserveRelation(this);
}
return State.CANCELED;
}
}
Expand Down

0 comments on commit 7e35e62

Please sign in to comment.