Merge session cache implementations.
[shibboleth/sp.git] / shibsp / remoting / impl / ListenerService.cpp
index 9261662..600c87f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 #include "internal.h"
 #include "exceptions.h"
+#include "ServiceProvider.h"
 #include "remoting/ListenerService.h"
 
-#include <log4cpp/Category.hh>
 #include <xercesc/dom/DOM.hpp>
 
 using namespace shibsp;
 using namespace xmltooling;
-using namespace log4cpp;
 using namespace xercesc;
 using namespace std;
 
 namespace shibsp {
-    //SHIBSP_DLLLOCAL PluginManager<ListenerService,const DOMElement*>::Factory MemoryListenerServiceFactory;
-    SHIBSP_DLLLOCAL PluginManager<ListenerService,const DOMElement*>::Factory TCPListenerServiceFactory;
+    SHIBSP_DLLLOCAL PluginManager<ListenerService,string,const DOMElement*>::Factory TCPListenerServiceFactory;
 #ifndef WIN32
-    SHIBSP_DLLLOCAL PluginManager<ListenerService,const DOMElement*>::Factory UnixListenerServiceFactory;
+    SHIBSP_DLLLOCAL PluginManager<ListenerService,string,const DOMElement*>::Factory UnixListenerServiceFactory;
 #endif
 };
 
 void SHIBSP_API shibsp::registerListenerServices()
 {
     SPConfig& conf=SPConfig::getConfig();
-    //conf.ListenerServiceManager.registerFactory(MEMORY_LISTENER_SERVICE, MemoryListenerServiceFactory);
     conf.ListenerServiceManager.registerFactory(TCP_LISTENER_SERVICE, TCPListenerServiceFactory);
 #ifndef WIN32
     conf.ListenerServiceManager.registerFactory(UNIX_LISTENER_SERVICE, UnixListenerServiceFactory);
@@ -82,7 +79,7 @@ Remoted* ListenerService::lookup(const char *address) const
     return (i==m_listenerMap.end()) ? NULL : i->second;
 }
 
-void ListenerService::receive(const DDF &in, ostream& out)
+void ListenerService::receive(DDF &in, ostream& out)
 {
     if (!in.name())
         throw ListenerException("Incoming message with no destination address rejected.");
@@ -92,6 +89,7 @@ void ListenerService::receive(const DDF &in, ostream& out)
         out << outmsg;
     }
 
+    Locker locker(SPConfig::getConfig().getServiceProvider());
     Remoted* dest=lookup(in.name());
     if (!dest)
         throw ListenerException("No destination registered for incoming message addressed to ($1).",params(1,in.name()));