提交 c7fd6899 编写于 作者: 如梦技术's avatar 如梦技术 🐛

开始 2.2.1-SNAPSHOT

上级 c4219ed1
......@@ -2,9 +2,9 @@ name: Publish Snapshot
on:
push:
branches: [ feature ]
branches: [ dev ]
pull_request:
branches: [ feature ]
branches: [ dev ]
jobs:
publish:
......
......@@ -22,6 +22,7 @@ import org.tio.core.ChannelContext;
import org.tio.core.TioConfig;
import org.tio.core.exception.TioDecodeException;
import org.tio.core.intf.Packet;
import org.tio.utils.buffer.ByteBufferAllocator;
import java.nio.ByteBuffer;
......
......@@ -16,7 +16,6 @@
package net.dreamlu.iot.mqtt.core.client;
import net.dreamlu.iot.mqtt.codec.ByteBufferAllocator;
import net.dreamlu.iot.mqtt.codec.MqttConstant;
import net.dreamlu.iot.mqtt.codec.MqttProperties;
import net.dreamlu.iot.mqtt.codec.MqttVersion;
......@@ -28,6 +27,7 @@ import org.tio.client.intf.TioClientHandler;
import org.tio.client.intf.TioClientListener;
import org.tio.core.TioConfig;
import org.tio.core.ssl.SslConfig;
import org.tio.utils.buffer.ByteBufferAllocator;
import org.tio.utils.hutool.StrUtil;
import org.tio.utils.thread.pool.SynThreadPoolExecutor;
import org.tio.utils.timer.DefaultTimerTaskService;
......
/*
* Copyright (c) 2019-2029, Dreamlu 卢春梦 (596392912@qq.com & dreamlu.net).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dreamlu.iot.mqtt.codec;
import java.nio.ByteBuffer;
/**
* ByteBufAllocator
*
* @author L.cm
*/
public enum ByteBufferAllocator {
/**
* 堆内存
*/
HEAP() {
@Override
public ByteBuffer allocate(int capacity) {
return ByteBuffer.allocate(capacity);
}
},
/**
* 直接内存
*/
DIRECT() {
@Override
public ByteBuffer allocate(int capacity) {
return ByteBuffer.allocateDirect(capacity);
}
};
public abstract ByteBuffer allocate(int capacity);
}
......@@ -17,6 +17,7 @@
package net.dreamlu.iot.mqtt.codec;
import org.tio.core.ChannelContext;
import org.tio.utils.buffer.ByteBufferAllocator;
import org.tio.utils.buffer.ByteBufferUtil;
import java.nio.ByteBuffer;
......@@ -504,7 +505,7 @@ public final class MqttEncoder {
}
private static byte[] encodeProperties(MqttProperties mqttProperties) {
WriteBuffer writeBuffer = new WriteBuffer();
WriteBuffer writeBuffer = new WriteBuffer(128);
for (MqttProperties.MqttProperty property : mqttProperties.listAll()) {
MqttProperties.MqttPropertyType propertyType = MqttProperties.MqttPropertyType.valueOf(property.propertyId);
switch (propertyType) {
......
......@@ -24,8 +24,8 @@ import org.tio.core.Tio;
import org.tio.core.TioConfig;
import org.tio.core.exception.TioDecodeException;
import org.tio.core.intf.Packet;
import org.tio.server.AcceptCompletionHandler;
import org.tio.server.intf.TioServerHandler;
import org.tio.utils.buffer.ByteBufferAllocator;
import org.tio.utils.hutool.StrUtil;
import java.nio.ByteBuffer;
......@@ -34,7 +34,7 @@ import java.nio.ByteBuffer;
* @author L.cm
*/
public class MqttServerAioHandler implements TioServerHandler {
private static final Logger log = LoggerFactory.getLogger(AcceptCompletionHandler.class);
private static final Logger log = LoggerFactory.getLogger(MqttServerAioHandler.class);
private final MqttDecoder mqttDecoder;
private final MqttEncoder mqttEncoder;
private final ByteBufferAllocator allocator;
......
......@@ -16,7 +16,6 @@
package net.dreamlu.iot.mqtt.core.server;
import net.dreamlu.iot.mqtt.codec.ByteBufferAllocator;
import net.dreamlu.iot.mqtt.codec.MqttConstant;
import net.dreamlu.iot.mqtt.core.server.auth.IMqttServerAuthHandler;
import net.dreamlu.iot.mqtt.core.server.auth.IMqttServerPublishPermission;
......@@ -49,6 +48,7 @@ import org.tio.server.TioServerConfig;
import org.tio.server.intf.TioServerHandler;
import org.tio.server.intf.TioServerListener;
import org.tio.utils.Threads;
import org.tio.utils.buffer.ByteBufferAllocator;
import org.tio.utils.hutool.StrUtil;
import org.tio.utils.json.JsonAdapter;
import org.tio.utils.json.JsonUtil;
......
......@@ -13,7 +13,7 @@
<properties>
<!-- mica-mqtt version -->
<revision>2.2.0</revision>
<revision>2.2.1-SNAPSHOT</revision>
<!-- java version -->
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......
......@@ -18,12 +18,12 @@ package net.dreamlu.iot.mqtt.spring.client.config;
import lombok.Getter;
import lombok.Setter;
import net.dreamlu.iot.mqtt.codec.ByteBufferAllocator;
import net.dreamlu.iot.mqtt.codec.MqttConstant;
import net.dreamlu.iot.mqtt.codec.MqttQoS;
import net.dreamlu.iot.mqtt.codec.MqttVersion;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.unit.DataSize;
import org.tio.utils.buffer.ByteBufferAllocator;
/**
* MqttClient 配置
......
......@@ -18,11 +18,11 @@ package net.dreamlu.iot.mqtt.spring.server.config;
import lombok.Getter;
import lombok.Setter;
import net.dreamlu.iot.mqtt.codec.ByteBufferAllocator;
import net.dreamlu.iot.mqtt.codec.MqttConstant;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.util.unit.DataSize;
import org.tio.core.ssl.ClientAuth;
import org.tio.utils.buffer.ByteBufferAllocator;
/**
* MqttServer 配置
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册