Skip to content

Commit

Permalink
Fix logging of MID matching.
Browse files Browse the repository at this point in the history
Recreated request from observation stores may not have a valid MID.

Signed-off-by: Achim Kraus <achim.kraus@bosch-si.com>
  • Loading branch information
Achim Kraus committed Oct 1, 2018
1 parent d9098a9 commit cbae059
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public Exchange receiveResponse(final Response response) {
EndpointContext context = exchange.getEndpointContext();
Request currentRequest = exchange.getCurrentRequest();
int requestMid = currentRequest.getMID();
if (context == null || requestMid == Message.NONE) {
if (context == null) {
LOGGER.debug("ignoring response {}, request pending to sent!", response);
return null;
}
Expand All @@ -264,8 +264,16 @@ public Exchange receiveResponse(final Response response) {
if (endpointContextMatcher.isResponseRelatedToRequest(context, response.getSourceContext())) {
if (response.getType() == Type.ACK && requestMid != response.getMID()) {
// The token matches but not the MID.
LOGGER.warn("possible MID reuse before lifetime end for token {}, expected MID {} but received {}",
response.getTokenString(), requestMid, response.getMID());
if (requestMid != Message.NONE) {
LOGGER.debug(
"possible MID reuse before lifetime end for token {}, expected MID {} but received {}",
response.getTokenString(), requestMid, response.getMID());
} else if (exchange.isNotification()) {
LOGGER.debug("possible duplicated ACK [MID={}] for observe [token={}]", response.getMID(),
response.getTokenString());
} else {
LOGGER.error("response {} matched to request without MID {}", response, currentRequest);
}
// when nested blockwise request/responses occurs (e.g.
// caused by retransmission), a old response may stop the
// retransmission of the current blockwise request. This
Expand Down

0 comments on commit cbae059

Please sign in to comment.