Browse Source
Merge pull request #1077 from chunyeow/master
add missing API limits on CoAP POST method
pull/1104/head
Andrew Shvayka
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
0 deletions
-
transport/coap/src/main/java/org/thingsboard/server/transport/coap/CoapTransportResource.java
|
|
@ -113,6 +113,12 @@ public class CoapTransportResource extends CoapResource { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void handlePOST(CoapExchange exchange) { |
|
|
public void handlePOST(CoapExchange exchange) { |
|
|
|
|
|
if(quotaService.isQuotaExceeded(exchange.getSourceAddress().getHostAddress())) { |
|
|
|
|
|
log.warn("COAP Quota exceeded for [{}:{}] . Disconnect", exchange.getSourceAddress().getHostAddress(), exchange.getSourcePort()); |
|
|
|
|
|
exchange.respond(ResponseCode.BAD_REQUEST); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Optional<FeatureType> featureType = getFeatureType(exchange.advanced().getRequest()); |
|
|
Optional<FeatureType> featureType = getFeatureType(exchange.advanced().getRequest()); |
|
|
if (!featureType.isPresent()) { |
|
|
if (!featureType.isPresent()) { |
|
|
log.trace("Missing feature type parameter"); |
|
|
log.trace("Missing feature type parameter"); |
|
|
|