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 2013/10/21 17:35:45 UTC

svn commit: r1534224 - in /qpid/proton/trunk: proton-c/src/messenger/ proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/ tests/python/proton_tests/ tests/tools/apps/c/ tests/tools/apps/python/

Author: rhs
Date: Mon Oct 21 15:35:44 2013
New Revision: 1534224

URL: http://svn.apache.org/r1534224
Log:
PROTON-278: fixed reply-to expansion to not expand unset reply-to addresses

Modified:
    qpid/proton/trunk/proton-c/src/messenger/messenger.c
    qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
    qpid/proton/trunk/tests/python/proton_tests/messenger.py
    qpid/proton/trunk/tests/tools/apps/c/msgr-send.c
    qpid/proton/trunk/tests/tools/apps/python/msgr-send.py

Modified: qpid/proton/trunk/proton-c/src/messenger/messenger.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/messenger/messenger.c?rev=1534224&r1=1534223&r2=1534224&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/messenger/messenger.c (original)
+++ qpid/proton/trunk/proton-c/src/messenger/messenger.c Mon Oct 21 15:35:44 2013
@@ -1169,7 +1169,7 @@ static void outward_munge(pn_messenger_t
     }
     sprintf(buf, "amqp://%s/%s", mng->name, address + 2);
     pn_message_set_reply_to(msg, buf);
-  } else if (len == 0) {
+  } else if (len == 1 && address[0] == '~') {
     unsigned needed = strlen(mng->name) + 8;
     if (needed > sizeof(stackbuf)) {
       heapbuf = (char *) malloc(needed);

Modified: qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java?rev=1534224&r1=1534223&r2=1534224&view=diff
==============================================================================
--- qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java (original)
+++ qpid/proton/trunk/proton-j/proton/src/main/java/org/apache/qpid/proton/messenger/impl/MessengerImpl.java Mon Oct 21 15:35:44 2013
@@ -1119,13 +1119,15 @@ public class MessengerImpl implements Me
     private void adjustReplyTo(Message m)
     {
         String original = m.getReplyTo();
-        if (original == null || original.length() == 0)
-        {
-            m.setReplyTo("amqp://" + _name);
-        }
-        else if (original.startsWith("~/"))
-        {
-            m.setReplyTo("amqp://" + _name + "/" + original.substring(2));
+        if (original != null) {
+            if (original.startsWith("~/"))
+            {
+                m.setReplyTo("amqp://" + _name + "/" + original.substring(2));
+            }
+            else if (original.equals("~"))
+            {
+                m.setReplyTo("amqp://" + _name);
+            }
         }
     }
 

Modified: qpid/proton/trunk/tests/python/proton_tests/messenger.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/messenger.py?rev=1534224&r1=1534223&r2=1534224&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/messenger.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/messenger.py Mon Oct 21 15:35:44 2013
@@ -128,6 +128,7 @@ class MessengerTest(Test):
     self.start()
     msg = Message()
     msg.address="amqp://0.0.0.0:12345"
+    msg.reply_to = "~"
     msg.subject="Hello World!"
     body = "First the world, then the galaxy!"
     if size is not None:
@@ -268,6 +269,7 @@ class MessengerTest(Test):
     self.start()
     msg = Message()
     msg.address="amqp://0.0.0.0:12345"
+    msg.reply_to = "~"
     msg.subject="Hello World!"
 
     self.client.outgoing_window = 10
@@ -301,6 +303,7 @@ class MessengerTest(Test):
 
     msg = Message()
     msg.address = "amqp://0.0.0.0:12345"
+    msg.reply_to = "~"
     msg.subject = "Hello World!"
 
     for i in range(2*size):
@@ -354,6 +357,7 @@ class MessengerTest(Test):
 
     msg = Message()
     msg.address="amqp://0.0.0.0:12345/XXX"
+    msg.reply_to = "~"
     msg.subject="Hello World!"
     body = "First the world, then the galaxy!"
     msg.body = body
@@ -371,6 +375,7 @@ class MessengerTest(Test):
 
     msg = Message()
     msg.address="amqp://0.0.0.0:12345/YYY"
+    msg.reply_to = "~"
     msg.subject="Hello World!"
     body = "First the world, then the galaxy!"
     msg.body = body
@@ -416,6 +421,7 @@ class MessengerTest(Test):
 
     msg = Message()
     msg.address = "route1"
+    msg.reply_to = "~"
     msg.body = "test"
     self.client.put(msg)
     self.client.recv(1)
@@ -425,6 +431,7 @@ class MessengerTest(Test):
 
     msg = Message()
     msg.address = "route2"
+    msg.reply_to = "~"
     msg.body = "test"
     self.client.put(msg)
     self.client.recv(1)
@@ -439,6 +446,7 @@ class MessengerTest(Test):
     msg = Message()
     msg.address = "asdf"
     msg.body = "test"
+    msg.reply_to = "~"
 
     self.client.put(msg)
     self.client.recv(1)
@@ -454,6 +462,7 @@ class MessengerTest(Test):
     msg = Message()
     msg.address = "asdf"
     msg.body = "test"
+    msg.reply_to = "~"
 
     self.client.put(msg)
     self.client.recv(1)
@@ -492,6 +501,7 @@ class MessengerTest(Test):
     msg = Message()
     msg.address = original
     msg.body = "test"
+    msg.reply_to = "~"
 
     self.client.put(msg)
     assert msg.address == original
@@ -613,6 +623,7 @@ class MessengerTest(Test):
     msg.subject="Hello World!"
     body = "First the world, then the galaxy!"
     msg.body = body
+    msg.reply_to = "~"
     self.client.put(msg)
     self.client.send()
     self.client.recv(1)

Modified: qpid/proton/trunk/tests/tools/apps/c/msgr-send.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/tools/apps/c/msgr-send.c?rev=1534224&r1=1534223&r2=1534224&view=diff
==============================================================================
--- qpid/proton/trunk/tests/tools/apps/c/msgr-send.c (original)
+++ qpid/proton/trunk/tests/tools/apps/c/msgr-send.c Mon Oct 21 15:35:44 2013
@@ -227,6 +227,7 @@ int main(int argc, char** argv)
 
     message = pn_message();
     check(message, "failed to allocate a message");
+    pn_message_set_reply_to(message, "~");
     pn_data_t *body = pn_message_body(message);
     char *data = (char *)calloc(1, opts.msg_size);
     pn_data_put_binary(body, pn_bytes(opts.msg_size, data));

Modified: qpid/proton/trunk/tests/tools/apps/python/msgr-send.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/tools/apps/python/msgr-send.py?rev=1534224&r1=1534223&r2=1534224&view=diff
==============================================================================
--- qpid/proton/trunk/tests/tools/apps/python/msgr-send.py (original)
+++ qpid/proton/trunk/tests/tools/apps/python/msgr-send.py Mon Oct 21 15:35:44 2013
@@ -131,6 +131,7 @@ def main(argv=None):
 
 
     message = Message()
+    message.reply_to = "~"
     message.load( "X" * opts.msg_size )
     reply_message = Message()
     messenger = Messenger( opts.name )



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