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

代码优化。

上级 54837baf
......@@ -88,7 +88,7 @@ public class MqttWsMsgHandler implements IWsMsgHandler {
@Override
public Object onBytes(WsRequest wsRequest, byte[] bytes, ChannelContext context) throws Exception {
WriteBuffer wsBody = (WriteBuffer) context.get(MQTT_WS_MSG_BODY_KEY);
ByteBuffer buffer = getMqttBody(wsBody, bytes, context);
ByteBuffer buffer = getMqttBody(wsBody, bytes);
if (buffer == null) {
return null;
}
......@@ -133,10 +133,9 @@ public class MqttWsMsgHandler implements IWsMsgHandler {
* 读取 mqtt 消息体处理半包的情况
*
* @param bytes 消息类容
* @param context ChannelContext
* @return ByteBuffer
*/
private static synchronized ByteBuffer getMqttBody(WriteBuffer wsBody, byte[] bytes, ChannelContext context) {
private static synchronized ByteBuffer getMqttBody(WriteBuffer wsBody, byte[] bytes) {
wsBody.writeBytes(bytes);
int length = wsBody.size();
if (length < 2) {
......
......@@ -6,14 +6,14 @@ RUN java -Djarmode=layertools -jar app.jar extract && rm app.jar
FROM moxm/java:1.8-full
LABEL maintainer="596392912@qq.com"
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
WORKDIR mica-mqtt
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms256m -Xmx256m -Djava.security.egd=file:/dev/./urandom"
WORKDIR /wwww/mica-mqtt
COPY --from=builder /build/dependencies/ ./
COPY --from=builder /build/snapshot-dependencies/ ./
COPY --from=builder /build/spring-boot-loader/ ./
COPY --from=builder /build/application/ ./
EXPOSE 5883 8083 30012
EXPOSE 3883 5883 8083 30012
CMD sleep 60; java $JAVA_OPTS org.springframework.boot.loader.JarLauncher
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册