Changeset - 05ff592fd0e1
[Not reviewed]
0 2 0
HanzZ - 14 years ago 2011-07-21 22:52:41
hanzz.k@gmail.com
Remove backend from backends list immediatelly after disconnection
2 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
spectrum/src/sample.cfg
Show inline comments
 
@@ -10,14 +10,14 @@ admin_username=admin
 
admin_password=test
 
#cert= #patch to PKCS#12 certificate
 
#cert_password= #password to that certificate if any
 
users_per_backend=1
 
backend=../../backends/libpurple/spectrum_libpurple_backend
 
#backend=../../backends/libircclient-qt/spectrum_libircclient-qt_backend
 
protocol=prpl-jabber
 
#protocol=prpl-msn
 
#protocol=prpl-jabber
 
protocol=prpl-msn
 
#protocol=prpl-icq
 

	
 
[backend]
 
default_avatar=catmelonhead.jpg
 

	
 
[logging]
src/networkpluginserver.cpp
Show inline comments
 
@@ -225,14 +225,14 @@ void NetworkPluginServer::handleSessionFinished(Backend *c) {
 
	for (std::list<User *>::const_iterator it = c->users.begin(); it != c->users.end(); it++) {
 
		LOG4CXX_ERROR(logger, "Backend " << c << " disconnected (probably crashed) with active user " << (*it)->getJID().toString());
 
		(*it)->setData(NULL);
 
		(*it)->handleDisconnected("Internal Server Error, please reconnect.");
 
	}
 

	
 
// 	c->connection->onDisconnected.connect(boost::bind(&NetworkPluginServer::handleSessionFinished, this, c));
 
// 	c->connection->onDataRead.connect(boost::bind(&NetworkPluginServer::handleDataRead, this, c, _1));
 
	c->connection->onDisconnected.disconnect(boost::bind(&NetworkPluginServer::handleSessionFinished, this, c));
 
	c->connection->onDataRead.disconnect(boost::bind(&NetworkPluginServer::handleDataRead, this, c, _1));
 

	
 
	m_clients.remove(c);
 
	delete c;
 

	
 
	// Execute new session only if there's no free one after this crash/disconnection
 
	for (std::list<Backend *>::const_iterator it = m_clients.begin(); it != m_clients.end(); it++) {
 
@@ -566,13 +566,13 @@ void NetworkPluginServer::pingTimeout() {
 
		if ((*it)->pongReceived || (*it)->pongReceived == -1) {
 
			sendPing((*it));
 
		}
 
		else {
 
			LOG4CXX_INFO(logger, "Disconnecting backend " << (*it) << ". PING response not received.");
 
			(*it)->connection->disconnect();
 
			(*it)->connection.reset();
 
			handleSessionFinished((*it));
 
		}
 
		
 
	}
 
	m_pingTimer->start();
 
}
 

	
 
@@ -712,13 +712,13 @@ void NetworkPluginServer::handleUserDestroyed(User *user) {
 
	}
 
	send(c->connection, message);
 
	c->users.remove(user);
 
	if (c->users.size() == 0) {
 
		LOG4CXX_INFO(logger, "Disconnecting backend " << c << ". There are no users.");
 
		c->connection->disconnect();
 
		c->connection.reset();
 
		handleSessionFinished(c);
 
// 		m_clients.erase(user->connection);
 
	}
 
}
 

	
 
void NetworkPluginServer::handleMessageReceived(NetworkConversation *conv, boost::shared_ptr<Swift::Message> &msg) {
 

	
0 comments (0 inline, 0 general)