Hello,

I recently hit a problem in mina 2.x (2.0.7).

It seems that I cannot flush the send queue no matter what I do.

    WriteFuture future = out.flush();
    future.awaitUninterruptibly(); //  This will never exit

The packet I'm sending is a 3 byte packet that is never sent. I need this packet to go out because it's an ack that must be sent within 200ms at most. But cannot force it out.

I have to push more data into the queue to force it be sent.

I also cannot close the session. No matter what I do. It also will hang forever.

How can I force this message go out?


I have a message encoder that works as follows:

public class ZVTMessageEncoder implements MessageEncoder<IZvtApdu> {
final static Logger log = LoggerFactory.getLogger(ZVTMessageEncoder.class);

    IZvtTransport transport;

    public ZVTMessageEncoder(IZvtTransport transport) {
        this.transport = transport;
    }

public void encode(IoSession session, IZvtApdu apdu, ProtocolEncoderOutput out)
            throws Exception {

        byte[] data = transport.createTpdu(apdu).getTPDUData();
        log.debug("Transmitting TPDU: {}",HexConversor.byteToString(data));
        IoBuffer buf = IoBuffer.allocate(data.length);
        buf.put(data);
        buf.flip(); // Required
        out.write(buf);
        WriteFuture future = out.flush();
        future.awaitUninterruptibly(); //  This will never exit
        log.debug("Sent!");

}

}

Reply via email to