NS_IMETHODIMP
nsFtpProtocolHandler::Observe(nsISupports *aSubject,
                              const char *aTopic,
                              const PRUnichar *aData)
{
    LOG(("FTP:observing [%s]\n", aTopic));

    if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
        nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(aSubject);
        if (!branch) {
            NS_ERROR("no prefbranch");
            return NS_ERROR_UNEXPECTED;
        }
        PRInt32 timeout;
        nsresult rv = branch->GetIntPref(IDLE_TIMEOUT_PREF, &timeout);
        if (NS_SUCCEEDED(rv))
            mIdleTimeout = timeout;
    } else if (!strcmp(aTopic, "network:offline-about-to-go-offline")) {
        ClearAllConnections();
    } else if (!strcmp(aTopic, "net:clear-active-logins")) {
        ClearAllConnections();
        mSessionId++;
    } else {
        NS_NOTREACHED("unexpected topic");
    }

    return NS_OK;
}
Exemple #2
0
	void ReadConf()
	{
		ConnMap conns;
		ConfigTagList tags = ServerInstance->Config->ConfTags("database");
		for(ConfigIter i = tags.first; i != tags.second; i++)
		{
			if (i->second->getString("module", "pgsql") != "pgsql")
				continue;
			std::string id = i->second->getString("id");
			ConnMap::iterator curr = connections.find(id);
			if (curr == connections.end())
			{
				SQLConn* conn = new SQLConn(this, i->second);
				conns.insert(std::make_pair(id, conn));
				ServerInstance->Modules->AddService(*conn);
			}
			else
			{
				conns.insert(*curr);
				connections.erase(curr);
			}
		}
		ClearAllConnections();
		conns.swap(connections);
	}
Exemple #3
0
	virtual ~ModuleSQLite3()
	{
		ClearQueue();
		ClearAllConnections();

		ServerInstance->SE->DelFd(listener);
		ServerInstance->BufferedSocketCull();

		if (QueueFD >= 0)
		{
			shutdown(QueueFD, 2);
			close(QueueFD);
		}

		if (notifier)
		{
			ServerInstance->SE->DelFd(notifier);
			notifier->Close();
			ServerInstance->BufferedSocketCull();
		}

		ServerInstance->Modules->UnpublishInterface("SQL", this);
		ServerInstance->Modules->UnpublishFeature("SQL");
		ServerInstance->Modules->DoneWithInterface("SQLutils");
	}
Exemple #4
0
	virtual ~ModulePgSQL()
	{
		if (retimer)
			ServerInstance->Timers->DelTimer(retimer);
		ClearAllConnections();
		delete[] sqlsuccess;
		ServerInstance->Modules->UnpublishInterface("SQL", this);
		ServerInstance->Modules->UnpublishFeature("SQL");
		ServerInstance->Modules->DoneWithInterface("SQLutils");
	}
Exemple #5
0
void PacketizedTCP::Stop(void)
{
	unsigned int i;
	for (i=0; i < messageHandlerList.Size(); i++)
		messageHandlerList[i]->OnRakPeerShutdown();
	for (i=0; i < waitingPackets.Size(); i++)
		DeallocatePacket(waitingPackets[i]);
	TCPInterface::Stop();
	ClearAllConnections();
}
Exemple #6
0
	~ModulePgSQL()
	{
		delete retimer;
		ClearAllConnections();
	}
Exemple #7
0
PacketizedTCP::~PacketizedTCP()
{
	ClearAllConnections();
}