[svn] gpgme - r1273 - trunk/gpgme
svn author marcus
cvs at cvs.gnupg.org
Fri Oct 5 02:21:01 CEST 2007
Author: marcus
Date: 2007-10-05 02:20:43 +0200 (Fri, 05 Oct 2007)
New Revision: 1273
Modified:
trunk/gpgme/ChangeLog
trunk/gpgme/kdpipeiodevice.cpp
trunk/gpgme/w32-qt-io.cpp
Log:
2007-10-05 Marcus Brinkmann <marcus at g10code.de>
* kdpipeiodevice.cpp, w32-qt-io.cpp: New versions from Frank
Osterfeld.
Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog 2007-10-04 14:09:58 UTC (rev 1272)
+++ trunk/gpgme/ChangeLog 2007-10-05 00:20:43 UTC (rev 1273)
@@ -1,3 +1,8 @@
+2007-10-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * kdpipeiodevice.cpp, w32-qt-io.cpp: New versions from Frank
+ Osterfeld.
+
2007-10-04 Marcus Brinkmann <marcus at g10code.de>
* kdpipeiodevice.h, kdpipeiodevice.cpp, kdpipeiodevice.moc,
Modified: trunk/gpgme/kdpipeiodevice.cpp
===================================================================
--- trunk/gpgme/kdpipeiodevice.cpp 2007-10-04 14:09:58 UTC (rev 1272)
+++ trunk/gpgme/kdpipeiodevice.cpp 2007-10-05 00:20:43 UTC (rev 1273)
@@ -493,7 +493,7 @@
{
d->startWriterThread();
LOCKED( d->writer );
- return d->writer->bufferFull() && !d->writer->error;
+ return !d->writer->bufferEmpty() && !d->writer->error;
}
@@ -684,6 +684,7 @@
if ( !cancel && ( eof || error ) ) {
qDebug( "%p: Reader::run: received eof(%d) or error(%d), waking everyone", this, eof, error );
notifyReadyRead();
+ cancel = true;
} else if ( !cancel && !bufferFull() && !bufferEmpty() ) {
qDebug( "%p: Reader::run: buffer no longer empty, waking everyone", this );
notifyReadyRead();
Modified: trunk/gpgme/w32-qt-io.cpp
===================================================================
--- trunk/gpgme/w32-qt-io.cpp 2007-10-04 14:09:58 UTC (rev 1272)
+++ trunk/gpgme/w32-qt-io.cpp 2007-10-05 00:20:43 UTC (rev 1273)
@@ -85,8 +85,9 @@
#define MAX_SLAFD 1024
struct DeviceEntry {
- DeviceEntry() : iodev( 0 ), refCount( 1 ) {}
+ DeviceEntry() : iodev( 0 ), refCount( 1 ), blocking( true ) {}
KDPipeIODevice* iodev;
+ bool blocking;
mutable int refCount;
void ref() const { ++refCount; }
int unref() const { assert( refCount > 0 ); return --refCount; }
@@ -152,7 +153,11 @@
return TRACE_SYSRES (-1);
}
TRACE_LOG1 ("channel %p", chan);
-
+ if ( iodevice_table[fd] && !iodevice_table[fd]->blocking && chan->readWouldBlock() ) {
+ errno = EAGAIN;
+ return TRACE_SYSRES( -1 );
+ }
+
nread = chan->read ((char *) buffer, count);
if (nread < 0)
{
@@ -185,6 +190,11 @@
return -1;
}
+ if ( iodevice_table[fd] && !iodevice_table[fd]->blocking && chan->writeWouldBlock() )
+ {
+ errno = EAGAIN;
+ return TRACE_SYSRES( -1 );
+ }
nwritten = chan->write ((char *) buffer, count);
if (nwritten < 0)
@@ -323,8 +333,9 @@
int
_gpgme_io_set_nonblocking (int fd)
{
- /* Qt always uses non-blocking IO, except for files, maybe, but who
- uses that? */
+ DeviceEntry* const entry = iodevice_table[fd];
+ assert( entry );
+ entry->blocking = false;
TRACE_BEG (DEBUG_SYSIO, "_gpgme_io_set_nonblocking", fd);
return TRACE_SYSRES (0);
}
More information about the Gnupg-commits
mailing list