mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1055401 - /mina/vysper/trunk/server/extensions/websockets/src/main/java/org/apache/vysper/xmpp/extension/websockets/WebsocketsBackedSessionContext.java
Date Wed, 05 Jan 2011 10:35:43 GMT
Author: ngn
Date: Wed Jan  5 10:35:43 2011
New Revision: 1055401

URL: http://svn.apache.org/viewvc?rev=1055401&view=rev
Log:
Fix bug in websockets where we sent stream:stream and stream:features in the same message

Modified:
    mina/vysper/trunk/server/extensions/websockets/src/main/java/org/apache/vysper/xmpp/extension/websockets/WebsocketsBackedSessionContext.java

Modified: mina/vysper/trunk/server/extensions/websockets/src/main/java/org/apache/vysper/xmpp/extension/websockets/WebsocketsBackedSessionContext.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/websockets/src/main/java/org/apache/vysper/xmpp/extension/websockets/WebsocketsBackedSessionContext.java?rev=1055401&r1=1055400&r2=1055401&view=diff
==============================================================================
--- mina/vysper/trunk/server/extensions/websockets/src/main/java/org/apache/vysper/xmpp/extension/websockets/WebsocketsBackedSessionContext.java
(original)
+++ mina/vysper/trunk/server/extensions/websockets/src/main/java/org/apache/vysper/xmpp/extension/websockets/WebsocketsBackedSessionContext.java
Wed Jan  5 10:35:43 2011
@@ -129,12 +129,16 @@ public class WebsocketsBackedSessionCont
     public void write(Stanza stanza) {
         // handle stream open
         Renderer renderer = new Renderer(stanza);
-        String xml;
         if("stream".equals(stanza.getName()) && NamespaceURIs.HTTP_ETHERX_JABBER_ORG_STREAMS.equals(stanza.getNamespaceURI()))
{
-            xml = renderer.getOpeningElement() + renderer.getElementContent();
+            // stream:stream and stream:features comes at the same time, split them 
+            send(renderer.getOpeningElement());
+            send(renderer.getElementContent());
         } else {
-            xml = renderer.getComplete();
+            send(renderer.getComplete());
         }
+    }
+
+    private void send(String xml) {
         try {
             LOG.info("> " + xml);
             outbound.sendMessage(xml);



Mime
View raw message