LWM2M: add new log.warn

This commit is contained in:
nickAS21 2021-06-08 11:27:49 +03:00
parent 9fd2d34e7c
commit 090fde16b4
3 changed files with 11 additions and 5 deletions

View File

@ -274,8 +274,8 @@ public class DefaultLwM2MTransportMsgHandler implements LwM2mTransportMsgHandler
private void removeClientCash(Registration registration) {
SessionInfoProto sessionInfo = this.getSessionInfoOrCloseSession(registration);
if (sessionInfo != null) {
// transportService.deregisterSession(sessionInfo);
// this.doCloseSession(sessionInfo);
transportService.deregisterSession(sessionInfo);
this.doCloseSession(sessionInfo);
sessionStore.remove(registration.getEndpoint());
clientContext.removeClientByRegistrationId(registration.getId());
@ -1283,7 +1283,7 @@ public class DefaultLwM2MTransportMsgHandler implements LwM2mTransportMsgHandler
if (lwM2MClient != null) {
SessionInfoProto sessionInfoProto = lwM2MClient.getSession();
if (sessionInfoProto == null) {
log.info("[{}] [{}]", lwM2MClient.getEndpoint(), CLIENT_NOT_AUTHORIZED);
log.trace("[{}] [{}]", lwM2MClient.getEndpoint(), CLIENT_NOT_AUTHORIZED);
this.removeClientCash(lwM2MClient.getRegistration());
}
return sessionInfoProto;
@ -1322,7 +1322,11 @@ public class DefaultLwM2MTransportMsgHandler implements LwM2mTransportMsgHandler
}
private void reportActivity() {
clientContext.getLwM2mClients().forEach(client -> reportActivityAndRegister(client.getSession()));
clientContext.getLwM2mClients().forEach(client -> {
log.warn("0_01) reportActivity clientEndpoint: [{}] session: [{}]", client.getEndpoint(), client.getSession());
reportActivityAndRegister(client.getSession());
}
);
}
/**

View File

@ -135,11 +135,12 @@ public class LwM2mTransportCoapResource extends AbstractLwM2mTransportResource {
int chunk = 0;
Response response = new Response(CoAP.ResponseCode.CONTENT);
byte[] fwData = this.getOtaData(currentId);
log.warn("91) read softWare data (length): [{}]", fwData.length);
if (fwData != null && fwData.length > 0) {
response.setPayload(fwData);
boolean moreFlag = fwData.length > chunkSize;
response.getOptions().setBlock2(chunkSize, moreFlag, chunk);
log.warn("91) Send currentId: [{}], length: [{}], chunkSize [{}], moreFlag [{}]", currentId.toString(), fwData.length, chunkSize, moreFlag);
log.warn("92) Send currentId: [{}], length: [{}], chunkSize [{}], moreFlag [{}]", currentId.toString(), fwData.length, chunkSize, moreFlag);
exchange.respond(response);
}

View File

@ -196,6 +196,7 @@ public class LwM2mFwSwUpdate {
String api = handler.config.getHostRequests();
int port = registration.getIdentity().isSecure() ? handler.config.getSecurePort() : handler.config.getPort();
String uri = "coap://" + api + ":" + Integer.valueOf(port) + "/" + OTA_COAP_RESOURCE + "/" + this.currentId.toString();
log.warn("89) coapUri: [{}]", uri);
request.sendAllRequest(this.lwM2MClient.getRegistration(), targetIdVer, WRITE_REPLACE, null,
uri, handler.config.getTimeout(), this.rpcRequest);
} else if (LwM2mTransportUtil.LwM2MFirmwareUpdateStrategy.OBJ_19_BINARY.code == this.updateStrategy) {