You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rh...@apache.org on 2014/02/06 16:47:50 UTC

svn commit: r1565312 - in /qpid/proton/trunk: proton-c/bindings/python/ proton-c/include/proton/ proton-c/src/engine/ proton-c/src/transport/ proton-j/src/main/java/org/apache/qpid/proton/engine/ proton-j/src/main/java/org/apache/qpid/proton/engine/imp...

Author: rhs
Date: Thu Feb  6 15:47:49 2014
New Revision: 1565312

URL: http://svn.apache.org/r1565312
Log:
PROTON-493: added accessors for channel-max

Modified:
    qpid/proton/trunk/proton-c/bindings/python/proton.py
    qpid/proton/trunk/proton-c/include/proton/engine.h
    qpid/proton/trunk/proton-c/src/engine/engine-internal.h
    qpid/proton/trunk/proton-c/src/transport/transport.c
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java
    qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
    qpid/proton/trunk/proton-j/src/main/resources/cengine.py
    qpid/proton/trunk/tests/python/proton_tests/engine.py

Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/proton.py?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/proton.py (original)
+++ qpid/proton/trunk/proton-c/bindings/python/proton.py Thu Feb  6 15:47:49 2014
@@ -2829,6 +2829,21 @@ Sets the maximum size for received frame
   def remote_max_frame_size(self):
     return pn_transport_get_remote_max_frame(self._trans)
 
+  def _get_channel_max(self):
+    return pn_transport_get_channel_max(self._trans)
+
+  def _set_channel_max(self, value):
+    pn_transport_set_channel_max(self._trans, value)
+
+  channel_max = property(_get_channel_max, _set_channel_max,
+                         doc="""
+Sets the maximum channel that may be used on the transport.
+""")
+
+  @property
+  def remote_channel_max(self):
+    return pn_transport_remote_channel_max(self._trans)
+
   # AMQP 1.0 idle-time-out
   def _get_idle_timeout(self):
     msec = pn_transport_get_idle_timeout(self._trans)

Modified: qpid/proton/trunk/proton-c/include/proton/engine.h
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/include/proton/engine.h?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/include/proton/engine.h (original)
+++ qpid/proton/trunk/proton-c/include/proton/engine.h Thu Feb  6 15:47:49 2014
@@ -442,14 +442,21 @@ PN_EXTERN void pn_transport_set_context(
 PN_EXTERN void *pn_transport_get_context(pn_transport_t *transport);
 PN_EXTERN void pn_transport_log(pn_transport_t *transport, const char *message);
 PN_EXTERN void pn_transport_logf(pn_transport_t *transport, const char *fmt, ...);
+
+PN_EXTERN uint16_t pn_transport_get_channel_max(pn_transport_t *transport);
+PN_EXTERN void pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max);
+PN_EXTERN uint16_t pn_transport_remote_channel_max(pn_transport_t *transport);
+
 // max frame of zero means "unlimited"
 PN_EXTERN uint32_t pn_transport_get_max_frame(pn_transport_t *transport);
 PN_EXTERN void pn_transport_set_max_frame(pn_transport_t *transport, uint32_t size);
 PN_EXTERN uint32_t pn_transport_get_remote_max_frame(pn_transport_t *transport);
+
 /* timeout of zero means "no timeout" */
 PN_EXTERN pn_millis_t pn_transport_get_idle_timeout(pn_transport_t *transport);
 PN_EXTERN void pn_transport_set_idle_timeout(pn_transport_t *transport, pn_millis_t timeout);
 PN_EXTERN pn_millis_t pn_transport_get_remote_idle_timeout(pn_transport_t *transport);
+
 PN_EXTERN uint64_t pn_transport_get_frames_output(const pn_transport_t *transport);
 PN_EXTERN uint64_t pn_transport_get_frames_input(const pn_transport_t *transport);
 PN_EXTERN bool pn_transport_quiesced(pn_transport_t *transport);

Modified: qpid/proton/trunk/proton-c/src/engine/engine-internal.h
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/engine/engine-internal.h?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/engine/engine-internal.h (original)
+++ qpid/proton/trunk/proton-c/src/engine/engine-internal.h Thu Feb  6 15:47:49 2014
@@ -122,6 +122,8 @@ struct pn_transport_t {
   bool close_rcvd;
   char *remote_container;
   char *remote_hostname;
+  uint16_t channel_max;
+  uint16_t remote_channel_max;
   pn_data_t *remote_offered_capabilities;
   pn_data_t *remote_desired_capabilities;
   pn_data_t *remote_properties;

Modified: qpid/proton/trunk/proton-c/src/transport/transport.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/transport/transport.c?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/transport/transport.c (original)
+++ qpid/proton/trunk/proton-c/src/transport/transport.c Thu Feb  6 15:47:49 2014
@@ -158,6 +158,8 @@ void pn_transport_init(pn_transport_t *t
   transport->remote_hostname = NULL;
   transport->local_max_frame = PN_DEFAULT_MAX_FRAME_SIZE;
   transport->remote_max_frame = 0;
+  transport->channel_max = 0;
+  transport->remote_channel_max = 0;
   transport->local_idle_timeout = 0;
   transport->dead_remote_deadline = 0;
   transport->last_bytes_input = 0;
@@ -403,9 +405,10 @@ int pn_do_open(pn_dispatcher_t *disp)
   pn_data_clear(transport->remote_offered_capabilities);
   pn_data_clear(transport->remote_desired_capabilities);
   pn_data_clear(transport->remote_properties);
-  int err = pn_scan_args(disp, "D.[?S?SI.I..CCC]", &container_q,
+  int err = pn_scan_args(disp, "D.[?S?SIHI..CCC]", &container_q,
                          &remote_container, &hostname_q, &remote_hostname,
                          &transport->remote_max_frame,
+                         &transport->remote_channel_max,
                          &transport->remote_idle_timeout,
                          transport->remote_offered_capabilities,
                          transport->remote_desired_capabilities,
@@ -1080,11 +1083,12 @@ int pn_process_conn_setup(pn_transport_t
     if (!(endpoint->state & PN_LOCAL_UNINIT) && !transport->open_sent)
     {
       pn_connection_t *connection = (pn_connection_t *) endpoint;
-      int err = pn_post_frame(transport->disp, 0, "DL[SS?In?InnCCC]", OPEN,
+      int err = pn_post_frame(transport->disp, 0, "DL[SS?I?H?InnCCC]", OPEN,
                               pn_string_get(connection->container),
                               pn_string_get(connection->hostname),
                               // if not zero, advertise our max frame size and idle timeout
                               (bool)transport->local_max_frame, transport->local_max_frame,
+                              (bool)transport->channel_max, transport->channel_max,
                               (bool)transport->local_idle_timeout, transport->local_idle_timeout,
                               connection->offered_capabilities,
                               connection->desired_capabilities,
@@ -1783,6 +1787,21 @@ void pn_transport_logf(pn_transport_t *t
   pn_transport_log(transport, pn_string_get(transport->scratch));
 }
 
+uint16_t pn_transport_get_channel_max(pn_transport_t *transport)
+{
+  return transport->channel_max;
+}
+
+void pn_transport_set_channel_max(pn_transport_t *transport, uint16_t channel_max)
+{
+  transport->channel_max = channel_max;
+}
+
+uint16_t pn_transport_remote_channel_max(pn_transport_t *transport)
+{
+  return transport->remote_channel_max;
+}
+
 uint32_t pn_transport_get_max_frame(pn_transport_t *transport)
 {
   return transport->local_max_frame;

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/Transport.java Thu Feb  6 15:47:49 2014
@@ -186,4 +186,11 @@ public interface Transport extends Endpo
     void setMaxFrameSize(int size);
 
     int getRemoteMaxFrameSize();
+
+    int getChannelMax();
+
+    void setChannelMax(int n);
+
+    int getRemoteChannelMax();
+
 }

Modified: qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java (original)
+++ qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/engine/impl/TransportImpl.java Thu Feb  6 15:47:49 2014
@@ -90,6 +90,8 @@ public class TransportImpl extends Endpo
 
     private int _maxFrameSize = DEFAULT_MAX_FRAME_SIZE;
     private int _remoteMaxFrameSize = 512;
+    private int _channelMax = 65535;
+    private int _remoteChannelMax = 65535;
 
     private final FrameWriter _frameWriter;
 
@@ -170,6 +172,24 @@ public class TransportImpl extends Endpo
     }
 
     @Override
+    public int getChannelMax()
+    {
+        return _channelMax;
+    }
+
+    @Override
+    public void setChannelMax(int n)
+    {
+        _channelMax = n;
+    }
+
+    @Override
+    public int getRemoteChannelMax()
+    {
+        return _remoteChannelMax;
+    }
+
+    @Override
     public void bind(Connection conn)
     {
         // TODO - check if already bound
@@ -704,7 +724,9 @@ public class TransportImpl extends Endpo
             if (_maxFrameSize > 0) {
                 open.setMaxFrameSize(UnsignedInteger.valueOf(_maxFrameSize));
             }
-            // TODO - populate;
+            if (_channelMax > 0) {
+                open.setChannelMax(UnsignedShort.valueOf((short) _channelMax));
+            }
 
             _isOpenSent = true;
 
@@ -916,6 +938,11 @@ public class TransportImpl extends Endpo
             _remoteMaxFrameSize = (int) open.getMaxFrameSize().longValue();
             _frameWriter.setMaxFrameSize(_remoteMaxFrameSize);
         }
+
+        if (open.getChannelMax().longValue() > 0)
+        {
+            _remoteChannelMax = (int) open.getChannelMax().longValue();
+        }
     }
 
     @Override

Modified: qpid/proton/trunk/proton-j/src/main/resources/cengine.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/resources/cengine.py?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/src/main/resources/cengine.py (original)
+++ qpid/proton/trunk/proton-j/src/main/resources/cengine.py Thu Feb  6 15:47:49 2014
@@ -855,6 +855,15 @@ def pn_transport_get_remote_max_frame(tr
 def pn_transport_set_idle_timeout(trans, value):
   raise Skipped()
 
+def pn_transport_set_channel_max(trans, n):
+  trans.impl.setChannelMax(n)
+
+def pn_transport_get_channel_max(trans):
+  return trans.impl.getChannelMax()
+
+def pn_transport_remote_channel_max(trans):
+  return trans.impl.getRemoteChannelMax()
+
 def pn_transport_bind(trans, conn):
   trans.impl.bind(conn.impl)
   return 0

Modified: qpid/proton/trunk/tests/python/proton_tests/engine.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/engine.py?rev=1565312&r1=1565311&r2=1565312&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/engine.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/engine.py Thu Feb  6 15:47:49 2014
@@ -197,6 +197,12 @@ class ConnectionTest(Test):
     assert self.c2.remote_properties == p1, (self.c2.remote_properties, p1)
     assert self.c1.remote_properties == p2, (self.c2.remote_properties, p2)
 
+  def test_channel_max(self, value=1234):
+    self.c1._transport.channel_max = value
+    self.c1.open()
+    self.pump()
+    assert self.c2._transport.remote_channel_max == value, (self.c2._transport.remote_channel_max, value)
+
 class SessionTest(Test):
 
   def setup(self):



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