|
@@ -12,7 +12,6 @@ import org.jetlinks.community.network.coap.resources.*;
|
|
|
import org.jetlinks.core.message.codec.CoapExchangeMessage;
|
|
import org.jetlinks.core.message.codec.CoapExchangeMessage;
|
|
|
import reactor.core.publisher.EmitterProcessor;
|
|
import reactor.core.publisher.EmitterProcessor;
|
|
|
import reactor.core.publisher.Flux;
|
|
import reactor.core.publisher.Flux;
|
|
|
-import reactor.core.publisher.FluxSink;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
|
|
|
|
|
@@ -20,7 +19,7 @@ import java.util.function.Function;
|
|
|
* @author lifang
|
|
* @author lifang
|
|
|
* @version 1.0.0
|
|
* @version 1.0.0
|
|
|
* @ClassName NetWorkCoapServer.java
|
|
* @ClassName NetWorkCoapServer.java
|
|
|
- * @Description TODO
|
|
|
|
|
|
|
+ * @Description coap服务
|
|
|
* @createTime 2021年12月16日 08:57:00
|
|
* @createTime 2021年12月16日 08:57:00
|
|
|
*/
|
|
*/
|
|
|
public class NetWorkCoapServer extends CoapServer implements Network {
|
|
public class NetWorkCoapServer extends CoapServer implements Network {
|
|
@@ -31,7 +30,6 @@ public class NetWorkCoapServer extends CoapServer implements Network {
|
|
|
@Getter
|
|
@Getter
|
|
|
private String id;
|
|
private String id;
|
|
|
private final EmitterProcessor<CoapExchangeMessage> processor=EmitterProcessor.create();
|
|
private final EmitterProcessor<CoapExchangeMessage> processor=EmitterProcessor.create();
|
|
|
- private final FluxSink<CoapExchangeMessage> sink=processor.sink(FluxSink.OverflowStrategy.BUFFER);
|
|
|
|
|
|
|
|
|
|
public NetWorkCoapServer( CoapServerProperties properties,String id){
|
|
public NetWorkCoapServer( CoapServerProperties properties,String id){
|
|
|
super();
|
|
super();
|
|
@@ -81,6 +79,9 @@ public class NetWorkCoapServer extends CoapServer implements Network {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public boolean isDtls(){
|
|
|
|
|
+ return Boolean.TRUE.equals(properties.isEnableDtls());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public Flux<CoapExchangeMessage> handleAuthRequest(){
|
|
public Flux<CoapExchangeMessage> handleAuthRequest(){
|
|
|
return processor.map(Function.identity());
|
|
return processor.map(Function.identity());
|