Skip to content

Commit

Permalink
Add mid to observation store setContext.
Browse files Browse the repository at this point in the history
Signed-off-by: Achim Kraus <achim.kraus@bosch-si.com>
  • Loading branch information
Achim Kraus committed Oct 1, 2018
1 parent cbae059 commit d3bddba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ protected void failed() {

@Override
public void onContextEstablished(EndpointContext endpointContext) {
observationStore.setContext(token, endpointContext);
observationStore.setContext(token, request.getMID(), endpointContext);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,13 @@ public void clear() {
}

@Override
public void setContext(Token token, final EndpointContext ctx) {
public void setContext(Token token, int mid, EndpointContext ctx) {

if (token != null && ctx != null) {
Observation obs = map.get(token);
if (obs != null) {
// though this implementation doesn't clone the request when put,
// the mid doesn't need to be updated!
map.replace(token, obs, new Observation(obs.getRequest(), ctx));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ public interface ObservationStore {
* </p>
*
* @param token The token of the observation to set the context on.
* @param mid assigned mid. The mid is usually not available, when the put is called.
* @param endpointContext The context to set.
*/
void setContext(Token token, EndpointContext endpointContext);
void setContext(Token token, int mid, EndpointContext endpointContext);

void start();

Expand Down

0 comments on commit d3bddba

Please sign in to comment.