Dummy-read stale input instead of flushing it in order to make it available for I/O Intr records.
This commit is contained in:
@ -617,19 +617,26 @@ writeHandler()
|
|||||||
clientName());
|
clientName());
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
pasynUser->timeout = writeTimeout;
|
|
||||||
|
|
||||||
// discard any early input or early events
|
// discard any early input, but forward it to potential async records
|
||||||
status = pasynOctet->flush(pvtOctet, pasynUser);
|
// thus do not use pasynOctet->flush()
|
||||||
|
pasynUser->timeout = 0;
|
||||||
|
do {
|
||||||
|
char buffer [256];
|
||||||
|
size_t received = sizeof(buffer);
|
||||||
|
int eomReason = 0;
|
||||||
|
status = pasynOctet->read(pvtOctet, pasynUser,
|
||||||
|
buffer, received, &received, &eomReason);
|
||||||
|
#ifndef NO_TEMPORARY
|
||||||
|
if (received) debug("AsynDriverInterface::writeHandler(%s): flushing %d bytes: \"%s\"\n",
|
||||||
|
clientName(), received, StreamBuffer(buffer, received).expand()());
|
||||||
|
#endif
|
||||||
|
} while (status != asynTimeout);
|
||||||
|
|
||||||
|
// discard any early events
|
||||||
receivedEvent = 0;
|
receivedEvent = 0;
|
||||||
|
|
||||||
if (status != asynSuccess)
|
pasynUser->timeout = writeTimeout;
|
||||||
{
|
|
||||||
error("%s: pasynOctet->flush() failed: %s\n",
|
|
||||||
clientName(), pasynUser->errorMessage);
|
|
||||||
writeCallback(StreamIoFault);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// has stream already added a terminator or should
|
// has stream already added a terminator or should
|
||||||
// asyn do so?
|
// asyn do so?
|
||||||
@ -739,7 +746,7 @@ readRequest(unsigned long replyTimeout_ms, unsigned long readTimeout_ms,
|
|||||||
long _expectedLength, bool async)
|
long _expectedLength, bool async)
|
||||||
{
|
{
|
||||||
debug("AsynDriverInterface::readRequest(%s, %ld msec reply, "
|
debug("AsynDriverInterface::readRequest(%s, %ld msec reply, "
|
||||||
"%ld msec read, expect %ld bytes, asyn=%s)\n",
|
"%ld msec read, expect %ld bytes, async=%s)\n",
|
||||||
clientName(), replyTimeout_ms, readTimeout_ms,
|
clientName(), replyTimeout_ms, readTimeout_ms,
|
||||||
_expectedLength, async?"yes":"no");
|
_expectedLength, async?"yes":"no");
|
||||||
|
|
||||||
@ -978,6 +985,9 @@ readHandler()
|
|||||||
// reply timeout
|
// reply timeout
|
||||||
if (ioAction == AsyncRead)
|
if (ioAction == AsyncRead)
|
||||||
{
|
{
|
||||||
|
debug("AsynDriverInterface::readHandler(%s): "
|
||||||
|
"no async input, retry in in %g seconds\n",
|
||||||
|
clientName(), replyTimeout);
|
||||||
// start next poll after timer expires
|
// start next poll after timer expires
|
||||||
if (replyTimeout != 0.0) startTimer(replyTimeout);
|
if (replyTimeout != 0.0) startTimer(replyTimeout);
|
||||||
// continues with:
|
// continues with:
|
||||||
@ -1255,6 +1265,9 @@ timerExpired()
|
|||||||
int autoconnect, connected;
|
int autoconnect, connected;
|
||||||
switch (ioAction)
|
switch (ioAction)
|
||||||
{
|
{
|
||||||
|
case None:
|
||||||
|
// Timeout of async poll crossed with parasitic input
|
||||||
|
return;
|
||||||
case ReceiveEvent:
|
case ReceiveEvent:
|
||||||
// timeout while waiting for event
|
// timeout while waiting for event
|
||||||
ioAction = None;
|
ioAction = None;
|
||||||
|
Reference in New Issue
Block a user