[svn] assuan - r315 - in trunk: . doc src
svn author marcus
cvs at cvs.gnupg.org
Thu Nov 5 03:15:05 CET 2009
Author: marcus
Date: 2009-11-05 03:15:04 +0100 (Thu, 05 Nov 2009)
New Revision: 315
Modified:
trunk/NEWS
trunk/doc/ChangeLog
trunk/doc/assuan.texi
trunk/src/ChangeLog
trunk/src/assuan-defs.h
trunk/src/assuan-handler.c
trunk/src/assuan.h
trunk/src/debug.c
Log:
doc/
2009-11-05 Marcus Brinkmann <marcus at g10code.de>
* assuan.texi (External I/O Loop Server): Document change to
assuan_process_next.
src/
2009-11-05 Marcus Brinkmann <marcus at g10code.de>
* assuan-defs.h (assuan_context_t): Add member PROCESS_DONE.
* assuan.h (assuan_process_next): Add argument DONE to prototype.
* assuan-handler.c (assuan_process_next): Likewise, handle it.
(std_handler_bye): Set PROCESS_DONE.
(assuan_process_done): Handle PROCESS_DONE in the no error case.
(assuan_process): Use PROCESS_DONE.
Modified: trunk/doc/ChangeLog
===================================================================
--- trunk/doc/ChangeLog 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/doc/ChangeLog 2009-11-05 02:15:04 UTC (rev 315)
@@ -1,3 +1,8 @@
+2009-11-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan.texi (External I/O Loop Server): Document change to
+ assuan_process_next.
+
2009-10-16 Marcus Brinkmann <marcus at g10code.com>
* assuan.texi: Remove documentation for thread support.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/src/ChangeLog 2009-11-05 02:15:04 UTC (rev 315)
@@ -1,3 +1,16 @@
+2009-11-05 Marcus Brinkmann <marcus at g10code.de>
+
+ * assuan-defs.h (assuan_context_t): Add member PROCESS_DONE.
+ * assuan.h (assuan_process_next): Add argument DONE to prototype.
+ * assuan-handler.c (assuan_process_next): Likewise, handle it.
+ (std_handler_bye): Set PROCESS_DONE.
+ (assuan_process_done): Handle PROCESS_DONE in the no error case.
+ (assuan_process): Use PROCESS_DONE.
+
+2009-11-04 Marcus Brinkmann <marcus at g10code.de>
+
+ * debug.c (_assuan_debug): Free MSG.
+
2009-11-04 Werner Koch <wk at g10code.com>
* Makefile.am (common_sources): Add debug.h.
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/NEWS 2009-11-05 02:15:04 UTC (rev 315)
@@ -75,6 +75,7 @@
assuan_register_cancel_notify CHANGED: Handler gets line and returns err now.
assuan_register_input_notify CHANGED: Handler returns error now.
assuan_register_output_notify CHANGED: Handler returns error now.
+assuan_process_next CHANGED: New DONE argument instead EOF return.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Modified: trunk/doc/assuan.texi
===================================================================
--- trunk/doc/assuan.texi 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/doc/assuan.texi 2009-11-05 02:15:04 UTC (rev 315)
@@ -1524,8 +1524,8 @@
readable, but Assuan does not check this.
The function @code{assuan_process_next} returns 0 if it can not make
-progress reliably, and it returns an end of file error value if the
-client closed the connection. See below for more information on this
+progress reliably, and it returns true in @code{done} if the client
+closed the connection. See below for more information on this
function.
@item
@@ -1562,11 +1562,10 @@
operations, the server should send progress status messages to the
client in regular intervals to notice when the client disconnects.
- at deftypefun gpg_error_t assuan_process_next (@w{assuan_context_t @var{ctx}})
+ at deftypefun gpg_error_t assuan_process_next (@w{assuan_context_t @var{ctx}}, @w{int *@var{done}})
This is the same as @code{assuan_process} but the caller has to
provide the outer loop. He should loop as long as the return code is
-zero and stop otherwise; @code{-1} or @code{GPG_ERR_EOF} indicate a
-regular end.
+zero and @var{done} is false.
@end deftypefun
@deftypefun gpg_error_t assuan_process_done (@w{assuan_context_t @var{ctx}}, @w{gpg_error_t @var{rc}})
Modified: trunk/src/assuan-defs.h
===================================================================
--- trunk/src/assuan-defs.h 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/src/assuan-defs.h 2009-11-05 02:15:04 UTC (rev 315)
@@ -124,6 +124,7 @@
int is_server; /* Set if this is context belongs to a server */
int in_inquire;
int in_process_next;
+ int process_done;
int in_command;
/* The following members are used by assuan_inquire_ext. */
Modified: trunk/src/assuan-handler.c
===================================================================
--- trunk/src/assuan-handler.c 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/src/assuan-handler.c 2009-11-05 02:15:04 UTC (rev 315)
@@ -125,7 +125,8 @@
assuan_close_input_fd (ctx);
assuan_close_output_fd (ctx);
/* pretty simple :-) */
- return PROCESS_DONE (ctx, _assuan_error (ctx, GPG_ERR_EOF));
+ ctx->process_done = 1;
+ return PROCESS_DONE (ctx, 0);
}
static gpg_error_t
@@ -592,18 +593,19 @@
/* Error handling. */
if (!rc)
{
- rc = assuan_write_line (ctx, ctx->okay_line ? ctx->okay_line : "OK");
+ if (ctx->process_done)
+ {
+ /* No error checking because the peer may have already
+ disconnect. */
+ assuan_write_line (ctx, "OK closing connection");
+ ctx->finish_handler (ctx);
+ }
+ else
+ rc = assuan_write_line (ctx, ctx->okay_line ? ctx->okay_line : "OK");
}
- else if (gpg_err_code (rc) == GPG_ERR_EOF)
- { /* No error checking because the peer may have already disconnect. */
- assuan_write_line (ctx, "OK closing connection");
- ctx->finish_handler (ctx);
- }
else
{
- char errline[300];
-
- const char *text = ctx->err_no == rc ? ctx->err_str : NULL;
+ char errline const char *text = ctx->err_no == rc ? ctx->err_str : NULL;
char ebuf[50];
gpg_strerror_r (rc, ebuf, sizeof (ebuf));
@@ -686,19 +688,25 @@
ready for reading. If the equivalent to EWOULDBLOCK is returned
(this should be done by the command handler), assuan_process_next
should be invoked the next time the connected FD is readable.
- Eventually, the caller will finish by invoking
- assuan_process_done. */
+ Eventually, the caller will finish by invoking assuan_process_done.
+ DONE is set to 1 if the connection has ended. */
gpg_error_t
-assuan_process_next (assuan_context_t ctx)
+assuan_process_next (assuan_context_t ctx, int *done)
{
gpg_error_t rc;
+ if (done)
+ *done = 0;
+ ctx->process_done = 0;
do
{
rc = process_next (ctx);
}
- while (!rc && assuan_pending_line (ctx));
+ while (!rc && !ctx->process_done && assuan_pending_line (ctx));
+ if (done)
+ *done = !!ctx->process_done;
+
return rc;
}
@@ -747,13 +755,11 @@
{
gpg_error_t rc;
+ ctx->process_done = 0;
do {
rc = process_request (ctx);
- } while (!rc);
+ } while (!rc && !ctx->process_done);
- if (gpg_err_code (rc) == GPG_ERR_EOF)
- rc = 0;
-
return rc;
}
Modified: trunk/src/assuan.h
===================================================================
--- trunk/src/assuan.h 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/src/assuan.h 2009-11-05 02:15:04 UTC (rev 315)
@@ -327,7 +327,7 @@
const char*));
gpg_error_t assuan_process (assuan_context_t ctx);
-gpg_error_t assuan_process_next (assuan_context_t ctx);
+gpg_error_t assuan_process_next (assuan_context_t ctx, int *done);
gpg_error_t assuan_process_done (assuan_context_t ctx, gpg_error_t rc);
int assuan_get_active_fds (assuan_context_t ctx, int what,
assuan_fd_t *fdarray, int fdarraysize);
Modified: trunk/src/debug.c
===================================================================
--- trunk/src/debug.c 2009-11-04 10:00:24 UTC (rev 314)
+++ trunk/src/debug.c 2009-11-05 02:15:04 UTC (rev 315)
@@ -59,6 +59,7 @@
if (res < 0)
return;
ctx->log_cb (ctx, ctx->log_cb_data, cat, msg);
+ free (msg);
errno = saved_errno;
}
More information about the Gnupg-commits
mailing list