Commit 88a4202d authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed error while binding new component domains. JM-624

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3698 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6abdaca5
...@@ -29,6 +29,7 @@ import java.io.IOException; ...@@ -29,6 +29,7 @@ import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List;
/** /**
* Represents a session between the server and a component. * Represents a session between the server and a component.
...@@ -182,7 +183,6 @@ public class ComponentSession extends Session { ...@@ -182,7 +183,6 @@ public class ComponentSession extends Session {
writer.flush(); writer.flush();
// Bind the domain to this component // Bind the domain to this component
ExternalComponent component = ((ComponentSession) session).getExternalComponent(); ExternalComponent component = ((ComponentSession) session).getExternalComponent();
component.setInitialSubdomain(subdomain);
InternalComponentManager.getInstance().addComponent(subdomain, component); InternalComponentManager.getInstance().addComponent(subdomain, component);
Log.debug("[ExComp] External component was registered SUCCESSFULLY with domain: " + Log.debug("[ExComp] External component was registered SUCCESSFULLY with domain: " +
domain); domain);
...@@ -231,15 +231,11 @@ public class ComponentSession extends Session { ...@@ -231,15 +231,11 @@ public class ComponentSession extends Session {
private String name = ""; private String name = "";
private String type = ""; private String type = "";
private String category = ""; private String category = "";
/**
* Subdomain used when creating the initial connection.
*/
private String initialSubdomain;
/** /**
* List of subdomains that were binded for this component. The list will include * List of subdomains that were binded for this component. The list will include
* the initial subdomain. * the initial subdomain.
*/ */
private Collection<String> subdomains = new ArrayList<String>(); private List<String> subdomains = new ArrayList<String>();
public void processPacket(Packet packet) { public void processPacket(Packet packet) {
if (conn != null && !conn.isClosed()) { if (conn != null && !conn.isClosed()) {
...@@ -282,15 +278,13 @@ public class ComponentSession extends Session { ...@@ -282,15 +278,13 @@ public class ComponentSession extends Session {
} }
public String getInitialSubdomain() { public String getInitialSubdomain() {
return initialSubdomain; if (subdomains.isEmpty()) {
} return null;
}
public void setInitialSubdomain(String initialSubdomain) { return subdomains.get(0);
this.initialSubdomain = initialSubdomain;
addSubdomain(initialSubdomain);
} }
public void addSubdomain(String subdomain) { private void addSubdomain(String subdomain) {
subdomains.add(subdomain); subdomains.add(subdomain);
} }
...@@ -299,6 +293,7 @@ public class ComponentSession extends Session { ...@@ -299,6 +293,7 @@ public class ComponentSession extends Session {
} }
public void initialize(JID jid, ComponentManager componentManager) { public void initialize(JID jid, ComponentManager componentManager) {
addSubdomain(jid.toString());
} }
public void start() { public void start() {
......
...@@ -75,7 +75,6 @@ public class ComponentSocketReader extends SocketReader { ...@@ -75,7 +75,6 @@ public class ComponentSocketReader extends SocketReader {
else { else {
try { try {
InternalComponentManager.getInstance().addComponent(extraDomain, component); InternalComponentManager.getInstance().addComponent(extraDomain, component);
component.addSubdomain(extraDomain);
// Send confirmation that the new domain has been registered // Send confirmation that the new domain has been registered
connection.deliverRawText("<bind/>"); connection.deliverRawText("<bind/>");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment