add config parameter: transport.coap.piggyback_timeout
This commit is contained in:
parent
5f548f2179
commit
80b7b9cee9
@ -703,6 +703,7 @@ transport:
|
||||
bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
|
||||
bind_port: "${COAP_BIND_PORT:5683}"
|
||||
timeout: "${COAP_TIMEOUT:10000}"
|
||||
piggyback_timeout: "${COAP_PIGGYBACK_TIMEOUT:500}"
|
||||
psm_activity_timer: "${COAP_PSM_ACTIVITY_TIMER:10000}"
|
||||
paging_transmission_window: "${COAP_PAGING_TRANSMISSION_WINDOW:10000}"
|
||||
dtls:
|
||||
|
||||
@ -38,6 +38,10 @@ public class CoapServerContext {
|
||||
@Value("${transport.coap.timeout}")
|
||||
private Long timeout;
|
||||
|
||||
@Getter
|
||||
@Value("${transport.coap.piggyback_timeout}")
|
||||
private Long piggybackTimeout;
|
||||
|
||||
@Getter
|
||||
@Value("${transport.coap.psm_activity_timer:10000}")
|
||||
private long psmActivityTimer;
|
||||
|
||||
@ -29,4 +29,6 @@ public interface CoapServerService {
|
||||
|
||||
long getTimeout();
|
||||
|
||||
long getPiggybackTimeout();
|
||||
|
||||
}
|
||||
|
||||
@ -88,6 +88,11 @@ public class DefaultCoapServerService implements CoapServerService {
|
||||
return coapServerContext.getTimeout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPiggybackTimeout() {
|
||||
return coapServerContext.getPiggybackTimeout();
|
||||
}
|
||||
|
||||
private CoapServer createCoapServer() throws UnknownHostException {
|
||||
Configuration networkConfig = new Configuration();
|
||||
networkConfig.set(CoapConfig.BLOCKWISE_STRICT_BLOCK2_OPTION, true);
|
||||
|
||||
@ -69,6 +69,7 @@ public class CoapTransportResource extends AbstractCoapTransportResource {
|
||||
|
||||
private final ConcurrentMap<InetSocketAddress, TbCoapDtlsSessionInfo> dtlsSessionsMap;
|
||||
private final long timeout;
|
||||
private final long piggybackTimeout;
|
||||
private final CoapClientContext clients;
|
||||
|
||||
public CoapTransportResource(CoapTransportContext ctx, CoapServerService coapServerService, String name) {
|
||||
@ -77,6 +78,7 @@ public class CoapTransportResource extends AbstractCoapTransportResource {
|
||||
this.addObserver(new CoapResourceObserver());
|
||||
this.dtlsSessionsMap = coapServerService.getDtlsSessionsMap();
|
||||
this.timeout = coapServerService.getTimeout();
|
||||
this.piggybackTimeout = coapServerService.getPiggybackTimeout();
|
||||
this.clients = ctx.getClientContext();
|
||||
long sessionReportTimeout = ctx.getSessionReportTimeout();
|
||||
ctx.getScheduler().scheduleAtFixedRate(clients::reportActivity, new Random().nextInt((int) sessionReportTimeout), sessionReportTimeout, TimeUnit.MILLISECONDS);
|
||||
@ -353,7 +355,7 @@ public class CoapTransportResource extends AbstractCoapTransportResource {
|
||||
* Essentially this allows the use of piggybacked responses.
|
||||
*/
|
||||
private void deferAccept(CoapExchange exchange) {
|
||||
transportContext.getScheduler().schedule(exchange::accept, 500, TimeUnit.MILLISECONDS);
|
||||
transportContext.getScheduler().schedule(exchange::accept, piggybackTimeout, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private UUID toSessionId(TransportProtos.SessionInfoProto sessionInfoProto) {
|
||||
|
||||
@ -89,6 +89,7 @@ transport:
|
||||
bind_address: "${COAP_BIND_ADDRESS:0.0.0.0}"
|
||||
bind_port: "${COAP_BIND_PORT:5683}"
|
||||
timeout: "${COAP_TIMEOUT:10000}"
|
||||
piggyback_timeout: "${COAP_PIGGYBACK_TIMEOUT:500}"
|
||||
psm_activity_timer: "${COAP_PSM_ACTIVITY_TIMER:10000}"
|
||||
paging_transmission_window: "${COAP_PAGING_TRANSMISSION_WINDOW:10000}"
|
||||
dtls:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user