You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2014/10/10 14:58:40 UTC

svn commit: r1630870 - in /qpid/proton/branches/examples/proton-c: include/proton/transport.h src/engine/engine-internal.h src/transport/transport.c

Author: gsim
Date: Fri Oct 10 12:58:40 2014
New Revision: 1630870

URL: http://svn.apache.org/r1630870
Log:
add a backwords compatible pn_transport_error

Modified:
    qpid/proton/branches/examples/proton-c/include/proton/transport.h
    qpid/proton/branches/examples/proton-c/src/engine/engine-internal.h
    qpid/proton/branches/examples/proton-c/src/transport/transport.c

Modified: qpid/proton/branches/examples/proton-c/include/proton/transport.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/include/proton/transport.h?rev=1630870&r1=1630869&r2=1630870&view=diff
==============================================================================
--- qpid/proton/branches/examples/proton-c/include/proton/transport.h (original)
+++ qpid/proton/branches/examples/proton-c/include/proton/transport.h Fri Oct 10 12:58:40 2014
@@ -118,6 +118,11 @@ PN_EXTERN void pn_transport_free(pn_tran
 PN_EXTERN pn_condition_t *pn_transport_condition(pn_transport_t *transport);
 
 /**
+ * @deprecated
+ */
+PN_EXTERN  pn_error_t *pn_transport_error(pn_transport_t *transport);
+
+/**
  * Binds the transport to an AMQP connection.
  *
  * @return an error code, or 0 on success

Modified: qpid/proton/branches/examples/proton-c/src/engine/engine-internal.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/src/engine/engine-internal.h?rev=1630870&r1=1630869&r2=1630870&view=diff
==============================================================================
--- qpid/proton/branches/examples/proton-c/src/engine/engine-internal.h (original)
+++ qpid/proton/branches/examples/proton-c/src/engine/engine-internal.h Fri Oct 10 12:58:40 2014
@@ -128,6 +128,7 @@ struct pn_transport_t {
   uint32_t   remote_max_frame;
   pn_condition_t remote_condition;
   pn_condition_t condition;
+  pn_error_t *error;
 
 #define PN_IO_SSL  0
 #define PN_IO_SASL 1

Modified: qpid/proton/branches/examples/proton-c/src/transport/transport.c
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/src/transport/transport.c?rev=1630870&r1=1630869&r2=1630870&view=diff
==============================================================================
--- qpid/proton/branches/examples/proton-c/src/transport/transport.c (original)
+++ qpid/proton/branches/examples/proton-c/src/transport/transport.c Fri Oct 10 12:58:40 2014
@@ -164,6 +164,7 @@ static void pn_transport_initialize(void
   transport->disp_data = pn_data(0);
   pn_condition_init(&transport->remote_condition);
   pn_condition_init(&transport->condition);
+  transport->error = pn_error();
 
   transport->local_channels = pn_hash(PN_OBJECT, 0, 0.75);
   transport->remote_channels = pn_hash(PN_OBJECT, 0, 0.75);
@@ -258,6 +259,7 @@ static void pn_transport_finalize(void *
   pn_free(transport->disp_data);
   pn_condition_tini(&transport->remote_condition);
   pn_condition_tini(&transport->condition);
+  pn_error_free(transport->error);
   pn_free(transport->local_channels);
   pn_free(transport->remote_channels);
   if (transport->input_buf) free(transport->input_buf);
@@ -349,7 +351,15 @@ int pn_transport_unbind(pn_transport_t *
 
 pn_error_t *pn_transport_error(pn_transport_t *transport)
 {
-  return NULL;
+  assert(transport);
+  if (pn_condition_is_set(&transport->condition)) {
+    pn_error_format(transport->error, PN_ERR, "%s: %s",
+                    pn_condition_get_name(&transport->condition),
+                    pn_condition_get_description(&transport->condition));
+  } else {
+    pn_error_clear(transport->error);
+  }
+  return transport->error;
 }
 
 pn_condition_t *pn_transport_condition(pn_transport_t *transport)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org