Index: /source/ariba/Node.cpp
===================================================================
--- /source/ariba/Node.cpp	(revision 3057)
+++ /source/ariba/Node.cpp	(revision 3067)
@@ -138,18 +138,18 @@
 }
 
-void Node::bind(NodeListener* listener) {
-	base_overlay->bind(listener);
-}
-
-void Node::unbind(NodeListener* listener) {
-	base_overlay->unbind(listener);
-}
-
-void Node::bind(CommunicationListener* listener, const ServiceID& sid) {
-	base_overlay->bind(listener, sid);
-}
-
-void Node::unbind(CommunicationListener* listener, const ServiceID& sid) {
-	base_overlay->unbind(listener, sid);
+bool Node::bind(NodeListener* listener) {
+	return base_overlay->bind(listener);
+}
+
+bool Node::unbind(NodeListener* listener) {
+	return base_overlay->unbind(listener);
+}
+
+bool Node::bind(CommunicationListener* listener, const ServiceID& sid) {
+	return base_overlay->bind(listener, sid);
+}
+
+bool Node::unbind(CommunicationListener* listener, const ServiceID& sid) {
+	return base_overlay->unbind(listener, sid);
 }
 
Index: /source/ariba/Node.h
===================================================================
--- /source/ariba/Node.h	(revision 3057)
+++ /source/ariba/Node.h	(revision 3067)
@@ -122,6 +122,7 @@
 	 *
 	 * @param listener The node listener
-	 */
-	void bind(NodeListener* listener);
+	 * @return boolean indicating success of failure
+	 */
+	bool bind(NodeListener* listener);
 
 	/**
@@ -129,6 +130,7 @@
 	 *
 	 * @param listener The node listener
-	 */
-	void unbind(NodeListener* listener);
+	 * @return boolean indicating success of failure
+	 */
+	bool unbind(NodeListener* listener);
 
 	//--- spovnet properties ---
@@ -266,6 +268,7 @@
 	 * @param listener The listener to be registered
 	 * @param sid The service identifier
-	 */
-	void bind(CommunicationListener* listener, const ServiceID& sid);
+	 * @return boolean indicating success of failure
+	 */
+	bool bind(CommunicationListener* listener, const ServiceID& sid);
 
 	/**
@@ -273,8 +276,9 @@
 	 *
 	 * @param The listener to be unbound
-	 */
-	void unbind(CommunicationListener* listener, const ServiceID& sid);
-
-	// --- extension proposal: service directory -- TODO
+	 * @return boolean indicating success of failure
+	 */
+	bool unbind(CommunicationListener* listener, const ServiceID& sid);
+
+	// --- extension proposal: service directory --
 	// main-idea: use this methods to register groups/rendevous points inside
 	// the base overlay via a distributed storage service.
Index: /source/ariba/communication/BaseCommunication.cpp
===================================================================
--- /source/ariba/communication/BaseCommunication.cpp	(revision 3057)
+++ /source/ariba/communication/BaseCommunication.cpp	(revision 3067)
@@ -457,4 +457,9 @@
 		logging_debug( "the link is now up with local link id " << spovmsg->getRemoteLink().toString() );
 
+		// notify the baseoverlay that the link is up, so
+		// it can exchange nodeids over this link. then we
+		// can send the queued messages, as both nodes have
+		// to know their nodeids first
+
 		BOOST_FOREACH( CommunicationEvents* i, eventListener ){
 			i->onLinkUp( linkDesc.localLink, linkDesc.localLocator, linkDesc.remoteLocator );
Index: /source/ariba/overlay/BaseOverlay.cpp
===================================================================
--- /source/ariba/overlay/BaseOverlay.cpp	(revision 3057)
+++ /source/ariba/overlay/BaseOverlay.cpp	(revision 3067)
@@ -123,12 +123,29 @@
 	logging_debug( "dropping all auto-links ..." );
 
+	// now we start leaving the spovnet: fist delete all links
+	// that we still have in the baseoverlay initiated by
+	// some services, the leave the actual overlay structure,
+	// then leave the spovnet
+
+	// --> drop all service links
+
+	vector<LinkID> servicelinks;
 	BOOST_FOREACH( LinkPair item, linkMapping ){
-		if( item.second.autolink )
-			dropLink( item.first );
-	}
+		if( item.second.service != OverlayInterface::OVERLAY_SERVICE_ID )
+			servicelinks.push_back( item.first );
+	}
+	BOOST_FOREACH( LinkID lnk, servicelinks ){
+		// the dropLink function will remove
+		// the item from the linkMapping
+		dropLink( lnk );
+	}
+
+	// --> leave overlay structure
 
 	logging_debug( "leaving overlay" );
 	// first, leave the overlay interface
 	overlayInterface->leaveOverlay();
+
+	// --> leave spovnet
 
 	if( state != BaseOverlayStateInitiator ){
@@ -185,23 +202,4 @@
 }
 
-const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const LinkID& link) const {
-
-	return bc->getEndpointDescriptor( link );
-}
-
-const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const NodeID& node) const {
-
-	if( node == nodeId || node == NodeID::UNSPECIFIED )
-		return bc->getEndpointDescriptor();
-
-	if( overlayInterface == NULL ){
-		logging_error( "overlay interface not set, cannot resolve endpoint" );
-		return EndpointDescriptor::UNSPECIFIED;
-	}
-
-	// TODO: if this is not a onehop overlay the operation will go asynchronously
-	return overlayInterface->resolveNode( node );
-}
-
 const LinkID BaseOverlay::establishLink(const NodeID& node, const ServiceID& service){
 
@@ -227,7 +225,7 @@
 	}
 
+	const LinkID link = bc->establishLink( ep );
+
 	CommunicationListener* receiver = communicationListeners.get( service );
-	const LinkID link = bc->establishLink( ep );
-
 	LinkItem item (link, NodeID::UNSPECIFIED, service, receiver);
 	linkMapping.insert( make_pair(link, item) );
@@ -292,8 +290,8 @@
 				". creating auto link ...");
 
-		const LinkID link = establishLink( node, service );
+		link = establishLink( node, service );
 		LinkMapping::iterator i = linkMapping.find( link );
 
-		if( i == linkMapping.end() ){
+		if( i == linkMapping.end() || link == LinkID::UNSPECIFIED ){
 			logging_error( "failed to establish auto link to node " << node.toString() <<
 					" for service " << service.toString() );
@@ -303,11 +301,42 @@
 		i->second.autolink = true;
 
+		logging_debug( "establishing autolink in progress to node "
+				<< node.toString() << " with new link-id " << link.toString() );
+
 	} // if( link != LinkID::UNSPECIFIED )
 
+	assert( link != LinkID::UNSPECIFIED );
+
+	// mark the link as used, as we
+	// now send a message through it
 	i->second.markused();
+
+	// send the message through the new link. the link may not be functional,
+	// but for us there is a link-id so we can send messages through it. if
+	// the link is not yet up and the message needs to be cached, this is the
+	// task of the BaseCommunication, it will cache and send it later.
 	return sendMessage( message, link );
 }
 
-void BaseOverlay::bind(CommunicationListener* listener, const ServiceID& sid){
+const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const LinkID& link) const {
+
+	return bc->getEndpointDescriptor( link );
+}
+
+const EndpointDescriptor& BaseOverlay::getEndpointDescriptor(const NodeID& node) const {
+
+	if( node == nodeId || node == NodeID::UNSPECIFIED )
+		return bc->getEndpointDescriptor();
+
+	if( overlayInterface == NULL ){
+		logging_error( "overlay interface not set, cannot resolve endpoint" );
+		return EndpointDescriptor::UNSPECIFIED;
+	}
+
+	// TODO: if this is not a onehop overlay the operation will go asynchronously
+	return overlayInterface->resolveNode( node );
+}
+
+bool BaseOverlay::bind(CommunicationListener* listener, const ServiceID& sid){
 	logging_debug( "binding communication listener " << listener
 		<< " on serviceid " << sid.toString() );
@@ -316,11 +345,12 @@
 		logging_error( "some listener already registered for service id "
 			<< sid.toString() );
-		return;
+		return false;
 	}
 
 	communicationListeners.registerItem( listener, sid );
-}
-
-void BaseOverlay::unbind(CommunicationListener* listener, const ServiceID& sid){
+	return true;
+}
+
+bool BaseOverlay::unbind(CommunicationListener* listener, const ServiceID& sid){
 	logging_debug( "unbinding listener " << listener
 		<< " from serviceid " << sid.toString() );
@@ -328,5 +358,5 @@
 	if( !communicationListeners.contains( sid ) ){
 		logging_warn( "cannot unbind listener. no listener registered on service id " << sid.toString() );
-		return;
+		return false;
 	}
 
@@ -334,11 +364,12 @@
 		logging_warn( "listener bound to service id " << sid.toString()
 			<< " is different than listener trying to unbind" );
-		return;
+		return false;
 	}
 
 	communicationListeners.unregisterItem( sid );
-}
-
-void BaseOverlay::bind(NodeListener* listener){
+	return true;
+}
+
+bool BaseOverlay::bind(NodeListener* listener){
 	logging_debug( "binding node listener " << listener );
 
@@ -346,11 +377,12 @@
 	if( i != nodeListeners.end() ){
 		logging_warn( "node listener " << listener << " is already bound, cannot bind" );
-		return;
+		return false;
 	}
 
 	nodeListeners.push_back( listener );
-}
-
-void BaseOverlay::unbind(NodeListener* listener){
+	return true;
+}
+
+bool BaseOverlay::unbind(NodeListener* listener){
 	logging_debug( "unbinding node listener " << listener );
 
@@ -358,8 +390,9 @@
 	if( i == nodeListeners.end() ){
 		logging_warn( "node listener " << listener << " is not bound, cannot unbind" );
-		return;
+		return false;
 	}
 
 	nodeListeners.erase( i );
+	return true;
 }
 
@@ -445,5 +478,8 @@
 	if( i == linkMapping.end() ) {
 		// this can also be one of the baseoverlay links that
-		// no mapping is stored for. therefore we issue no warning
+		// no mapping is stored for. therefore we issue no warning.
+		// it can also be a link that has been dropped and the
+		// mapping is already deleted in the dropLink function.
+		// also, the service notification is issued then in dropLink
 		return;
 	}
Index: /source/ariba/overlay/BaseOverlay.h
===================================================================
--- /source/ariba/overlay/BaseOverlay.h	(revision 3057)
+++ /source/ariba/overlay/BaseOverlay.h	(revision 3067)
@@ -202,20 +202,20 @@
 	 * TODO
 	 */
-	void bind(CommunicationListener* listener, const ServiceID& sid);
-
-	/**
-	 * TODO
-	 */
-	void unbind(CommunicationListener* listener, const ServiceID& sid);
-
-	/**
-	 * TODO
-	 */
-	void bind(NodeListener* listener);
-
-	/**
-	 * TODO
-	 */
-	void unbind(NodeListener* listener);
+	bool bind(CommunicationListener* listener, const ServiceID& sid);
+
+	/**
+	 * TODO
+	 */
+	bool unbind(CommunicationListener* listener, const ServiceID& sid);
+
+	/**
+	 * TODO
+	 */
+	bool bind(NodeListener* listener);
+
+	/**
+	 * TODO
+	 */
+	bool unbind(NodeListener* listener);
 
 	/**
Index: /source/ariba/overlay/modules/OverlayInterface.h
===================================================================
--- /source/ariba/overlay/modules/OverlayInterface.h	(revision 3057)
+++ /source/ariba/overlay/modules/OverlayInterface.h	(revision 3067)
@@ -58,4 +58,5 @@
 
 class OverlayInterface : public CommunicationListener {
+	friend class BaseOverlay;
 public:
 	OverlayInterface(
Index: /source/ariba/overlay/modules/onehop/OneHop.cpp
===================================================================
--- /source/ariba/overlay/modules/onehop/OneHop.cpp	(revision 3057)
+++ /source/ariba/overlay/modules/onehop/OneHop.cpp	(revision 3067)
@@ -146,4 +146,11 @@
 	logging_info( "leaving onehop overlay structure" );
 
+	// set the state to invalid, this will prevent from
+	// handling onLinkDown events, as we are traversing the
+	// overlayNodes map and the onLinkDown function is called
+	// from the BaseOverlay and OneHop::onLinkDown will also
+	// try to access the overlayNodes structure.
+	state = OneHopStateInvalid;
+
 	//
 	// close all links, this will indicate the other nodes that we left
@@ -158,5 +165,4 @@
 	}
 
-	state = OneHopStateInvalid;
 	pendingLinks = 0;
 }
@@ -164,4 +170,8 @@
 
 void OneHop::onLinkDown(const LinkID& lnk, const NodeID& remote){
+
+	// don't handle when we are in state-invalid,
+	// see comment in OneHop::leaveOverlay
+	if( state == OneHopStateInvalid ) return;
 
 	//
Index: urce/ariba/utility/system/README
===================================================================
--- /source/ariba/utility/system/README	(revision 3057)
+++ 	(revision )
@@ -1,6 +1,0 @@
-This directory contains utility classes that help to adapt ariba
-to realworld and simulation environments. This especially includes
-a SystemQueue for scheduling. A timer class for commonly used timers. A 
-StartupWrapper that is used to start the initial application or service, 
-as well as some convenience classes, like BlockingMethod, that allows
-an easier integration of blocking calls in real world applications.
Index: /source/ariba/utility/system/StartupWrapper.cpp
===================================================================
--- /source/ariba/utility/system/StartupWrapper.cpp	(revision 3057)
+++ /source/ariba/utility/system/StartupWrapper.cpp	(revision 3067)
@@ -103,5 +103,5 @@
 	{
 		log4cxx::LoggerPtr logger(log4cxx::Logger::getRootLogger());
-		logger->setLevel(log4cxx::Level::getDebug());
+		logger->setLevel(log4cxx::Level::getInfo());
 	}
 
