Commit 55ece585b5ee34967048053138b93004d0bd81c4

Authored by Chun-Yeow Yeoh
1 parent 8ea7058d

add missing API limits on CoAP POST method

Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
... ... @@ -113,6 +113,12 @@ public class CoapTransportResource extends CoapResource {
113 113
114 114 @Override
115 115 public void handlePOST(CoapExchange exchange) {
  116 + if(quotaService.isQuotaExceeded(exchange.getSourceAddress().getHostAddress())) {
  117 + log.warn("COAP Quota exceeded for [{}:{}] . Disconnect", exchange.getSourceAddress().getHostAddress(), exchange.getSourcePort());
  118 + exchange.respond(ResponseCode.BAD_REQUEST);
  119 + return;
  120 + }
  121 +
116 122 Optional<FeatureType> featureType = getFeatureType(exchange.advanced().getRequest());
117 123 if (!featureType.isPresent()) {
118 124 log.trace("Missing feature type parameter");
... ...