WriteFuture.isWritten() never returns true even when data is actually sent on
the serial port using serial transport
--------------------------------------------------------------------------------------------------------------------
Key: DIRMINA-647
URL: https://issues.apache.org/jira/browse/DIRMINA-647
Project: MINA
Issue Type: Bug
Components: Transport
Affects Versions: 2.0.0-M3
Environment: MINA : 2.0.0-M3
Netbeans 6.5
Serial port (both hardware COM1 and using com0com's virtual serial ports)
JDK 1.6.10
Windows XP (Service Pack 3)
Reporter: Akbar Munir Chaudhary
The serial transport never sets the WriteFuture.isWritten() to true, even when
the data has been written on the serial port. The
WriteFuture.awaitUninterruptibly() without any timeout never returns and if
WriteFuture.awaitUninterruptibly() is used with a timeout, then it returns but
specifies the WriteFuture.isWritten() as false.
The following code is the basic usage of serial transport:
-----------------------------------------------------------------------
SerialAddress a = new SerialAddress("COM1", 115200,
SerialAddress.DataBits.DATABITS_8, SerialAddress.StopBits.BITS_1,
SerialAddress.Parity.NONE, SerialAddress.FlowControl.NONE);
IoConnector c = new SerialConnector();
c.setHandler(this);
ConnectFuture cf = c.connect(a);
cf.awaitUninterruptibly();
System.out.println("Connection = " + cf.isConnected());
if (cf.isConnected())
{
IoSession s = cf.getSession();
IoBuffer b = IoBuffer.allocate(32);
b.put(new String("this is a test message").getBytes());
b.flip();
WriteFuture wf = s.write(b);
wf.awaitUninterruptibly(5, TimeUnit.SECONDS);
System.out.println("Message Written = " + wf.isWritten());
}
-----------------------------------------------------------------------
Using a cross serial cable, the serial data does reach the other end, but the
WriteFuture does not say so. I think the problem may be with the file
SerialSessionImpl.java after the line 185. After the buffer data has been
written to the serial port's output stream and the buffer position has been
adjusted, the WriteFuture in the write request is not notified. If I add the
line:
-----------------------------------------------------------------------
req.getFuture().setWritten();
-----------------------------------------------------------------------
right after the line # 185, it starts to work for all my examples.
Thanks,
Akbar.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.