[svn] assuan - r273 - trunk/src
svn author marcus
cvs at cvs.gnupg.org
Fri Oct 5 18:44:18 CEST 2007
Author: marcus
Date: 2007-10-05 18:44:08 +0200 (Fri, 05 Oct 2007)
New Revision: 273
Modified:
trunk/src/ChangeLog
trunk/src/assuan-buffer.c
trunk/src/assuan-client.c
trunk/src/assuan-defs.h
trunk/src/assuan-handler.c
trunk/src/mkerrors
Log:
2007-10-05 Marcus Brinkmann <marcus at g10code.de>
* assuan-defs.h (_assuan_error_is_eagain): New prototype.
* mkerrors (_assuan_error_is_eagain): New function.
* assuan-handler.c (process_next): Leave on EAGAIN.
* assuan-handler.c (process_request),
assuan-client.c (_assuan_read_from_server),
assuan-buffer.c (assuan_read_line): Busy loop over EAGAIN.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-10-05 16:19:51 UTC (rev 272)
+++ trunk/src/ChangeLog 2007-10-05 16:44:08 UTC (rev 273)
@@ -1,3 +1,12 @@
+2007-10-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-defs.h (_assuan_error_is_eagain): New prototype.
+ * mkerrors (_assuan_error_is_eagain): New function.
+ * assuan-handler.c (process_next): Leave on EAGAIN.
+ * assuan-handler.c (process_request),
+ assuan-client.c (_assuan_read_from_server),
+ assuan-buffer.c (assuan_read_line): Busy loop over EAGAIN.
+
2007-10-05 Werner Koch <wk at g10code.com>
* assuan-socket.c (_assuan_sock_wsa2errno): Map WSANOTINITIALISED.
Modified: trunk/src/assuan-buffer.c
===================================================================
--- trunk/src/assuan-buffer.c 2007-10-05 16:19:51 UTC (rev 272)
+++ trunk/src/assuan-buffer.c 2007-10-05 16:44:08 UTC (rev 273)
@@ -93,7 +93,7 @@
}
-/* Function returns an Assuan error. */
+/* Function returns an Assuan error. */
assuan_error_t
_assuan_read_line (assuan_context_t ctx)
{
@@ -245,7 +245,12 @@
if (!ctx)
return _assuan_error (ASSUAN_Invalid_Value);
- err = _assuan_read_line (ctx);
+ do
+ {
+ err = _assuan_read_line (ctx);
+ }
+ while (_assuan_error_is_eagain (err));
+
*line = ctx->inbound.line;
*linelen = ctx->inbound.linelen;
return err;
Modified: trunk/src/assuan-client.c
===================================================================
--- trunk/src/assuan-client.c 2007-10-05 16:19:51 UTC (rev 272)
+++ trunk/src/assuan-client.c 2007-10-05 16:44:08 UTC (rev 273)
@@ -42,7 +42,11 @@
*off = 0;
do
{
- rc = _assuan_read_line (ctx);
+ do
+ {
+ rc = _assuan_read_line (ctx);
+ }
+ while (_assuan_error_is_eagain (rc));
if (rc)
return rc;
line = ctx->inbound.line;
Modified: trunk/src/assuan-defs.h
===================================================================
--- trunk/src/assuan-defs.h 2007-10-05 16:19:51 UTC (rev 272)
+++ trunk/src/assuan-defs.h 2007-10-05 16:44:08 UTC (rev 273)
@@ -234,6 +234,8 @@
/* Map error codes as used in this implementation to the libgpg-error
codes. */
assuan_error_t _assuan_error (int oldcode);
+/* Check if ERR means EAGAIN. */
+int _assuan_error_is_eagain (assuan_error_t err);
/* Extract the error code from A. This works for both the old and the
new style error codes. This needs to be used whenever an error
Modified: trunk/src/assuan-handler.c
===================================================================
--- trunk/src/assuan-handler.c 2007-10-05 16:19:51 UTC (rev 272)
+++ trunk/src/assuan-handler.c 2007-10-05 16:44:08 UTC (rev 273)
@@ -612,6 +612,8 @@
required to write full lines without blocking long after starting
a partial line. */
rc = _assuan_read_line (ctx);
+ if (_assuan_error_is_eagain (rc))
+ return 0;
if (rc)
return rc;
if (*ctx->inbound.line == '#' || !ctx->inbound.linelen)
@@ -683,7 +685,11 @@
if (ctx->in_inquire)
return _assuan_error (ASSUAN_Nested_Commands);
- rc = _assuan_read_line (ctx);
+ do
+ {
+ rc = _assuan_read_line (ctx);
+ }
+ while (_assuan_error_is_eagain (rc));
if (rc)
return rc;
if (*ctx->inbound.line == '#' || !ctx->inbound.linelen)
Modified: trunk/src/mkerrors
===================================================================
--- trunk/src/mkerrors 2007-10-05 16:19:51 UTC (rev 272)
+++ trunk/src/mkerrors 2007-10-05 16:44:08 UTC (rev 273)
@@ -141,6 +141,19 @@
}
+/* A small helper function to treat EAGAIN transparently to the
+ caller. */
+int
+_assuan_error_is_eagain (assuan_error_t err)
+{
+ if ((!err_source && err == ASSUAN_Read_Error && errno == EAGAIN)
+ || (err_source && (err & ((1 << 24) - 1)) == (6 | (1 << 15))))
+ return 1;
+ else
+ return 0;
+}
+
+
/**
* assuan_strerror:
* @err: Error code
More information about the Gnupg-commits
mailing list