Experimental Physics and
| |||||||||||||||
|
I took some time to look at the asyn code this morning. I am looking at ASYN 4-6. Mark Rivers wrote:I believe asyn is doing the flush operation that Emmanuel suggested. As far as I can tell, there is no flush before writes at either the devGpib level or the port driver level for drvAsynSerialPort or drvAsynIPPort. What I did find was that in the drvAsynSerialPort.c file that a timeout at this level causes a flush. There is no similiar flush in the drvAsynIPPort.c code. I suspect you are not getting out of order replies. I think you are getting a timeout, but then stale data from some buffer is ending up in the apparent data you received with the timeout. The "out of order" data seems to be coming from the OS socket buffer (I am running under linux). They are never flushed after a timeout. This looks like a "possible" bug to me, and think that flushing the buffer would do away with my "out of order error", BUT I don't think it is the root cause of my problem. After taking a second look at the code, I think I have found the root of my problem. I was puzzled by the fact that the code seemed to work with an older version of ASYN and that increasing the timeout parameter had no effect on the problem. It appears that when the timeout handling code was removed from the drvAsynIPPort driver the SOCK_EINTR error return from the recv is now treated as if it were a timeout. In the previous version of the code that I have and in the drvAsynSerialPort code, the recv was inside a for(;;) loop which would retry the read in the EINTR error state. I will try to put together a patch to retry to the recv on SOCK_EINTR in the next day or so.
| ||||||||||||||
ANJ, 10 Nov 2011 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |