Commit 474dc16799725b95ee429f46172f3dc584d96ab6
Committed by
GitHub
Merge pull request #1077 from chunyeow/master
add missing API limits on CoAP POST method
Showing
1 changed file
with
6 additions
and
0 deletions
@@ -113,6 +113,12 @@ public class CoapTransportResource extends CoapResource { | @@ -113,6 +113,12 @@ public class CoapTransportResource extends CoapResource { | ||
113 | 113 | ||
114 | @Override | 114 | @Override |
115 | public void handlePOST(CoapExchange exchange) { | 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 | Optional<FeatureType> featureType = getFeatureType(exchange.advanced().getRequest()); | 122 | Optional<FeatureType> featureType = getFeatureType(exchange.advanced().getRequest()); |
117 | if (!featureType.isPresent()) { | 123 | if (!featureType.isPresent()) { |
118 | log.trace("Missing feature type parameter"); | 124 | log.trace("Missing feature type parameter"); |