MangoAutomation / modbus4j

A high-performance and ease-of-use implementation of the Modbus protocol written in Java. Supports ASCII, RTU, TCP, and UDP transports as slave or master, automatic request partitioning and response data type parsing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StreamTransport::removeConsumer方法bug

l505654754 opened this issue · comments

使用RtuMaster发送消息只要发生异常就会关闭连接调用到这个方法,而下次尝试打开连接又会先调用这个方法产生空指针从而打开失败。导致永远都连不上,除非自己创建新的RtuMaster实例

package com.serotonin.modbus4j.sero.messaging;
public class StreamTransport implements Transport, Runnable {

...

    /**
     * <p>removeConsumer.</p>
     */
    public void removeConsumer() {
        listener.stop();
        listener = null;
    }

...
}