Files
@ 0729d364ca25
Branch filter:
Location: libtransport.git/include/Swiften/Server/Server.h - annotation
0729d364ca25
3.1 KiB
text/plain
Fix double free in DummyConnectionServer
Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
Do not create shared ptr from this as this lead to double free in
UserRegistryTest::login test. Shared ptr was needed to set event
owner in acceptConnection, actually it is never needed as events
are never filtered by owner. Thus it was removed and there is no
need to create shared ptr from this.
828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 6d2f8c192761 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 6d2f8c192761 ab2424659344 f81a8aa784da 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 df369e65d8f0 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 6d2f8c192761 75bc454c85c2 75bc454c85c2 75bc454c85c2 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 ab2424659344 828ae9d2cb88 828ae9d2cb88 6d2f8c192761 6d2f8c192761 6d2f8c192761 6d2f8c192761 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 6d2f8c192761 6d2f8c192761 6d2f8c192761 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 828ae9d2cb88 ab2424659344 f81a8aa784da df369e65d8f0 828ae9d2cb88 828ae9d2cb88 | /*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <boost/signals2.hpp>
#include <vector>
#include "Swiften/Network/BoostIOServiceThread.h"
#include "Swiften/Network/ConnectionServer.h"
#include "Swiften/Server/UserRegistry.h"
#include "Swiften/Server/ServerSession.h"
#include "Swiften/Base/IDGenerator.h"
#include "Swiften/Server/ServerFromClientSession.h"
#include "Swiften/JID/JID.h"
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Entity/Entity.h"
#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h"
#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
#include "Swiften/SwiftenCompat.h"
#include <Swiften/TLS/CertificateWithKey.h>
#include <Swiften/Parser/PlatformXMLParserFactory.h>
namespace Swift {
class ConnectionServer;
class SessionTracer;
class EventLoop;
class NetworkFactories;
class StanzaChannel;
class IQRouter;
class TLSServerContextFactory;
class Server : public Entity {
public:
Server(EventLoop* eventLoop, NetworkFactories* networkFactories, UserRegistry *userRegistry, const JID& jid, const std::string &address, int port);
~Server();
void start();
void stop();
int getPort() const {
return port_;
}
StanzaChannel* getStanzaChannel() const {
return stanzaChannel_;
}
IQRouter* getIQRouter() const {
return iqRouter_;
}
SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> getConnectionServer() const {
return serverFromClientConnectionServer;
}
boost::signal<void (const SafeByteArray&)> onDataRead;
boost::signal<void (const SafeByteArray&)> onDataWritten;
void addTLSEncryption(TLSServerContextFactory* tlsContextFactory, CertificateWithKey::ref cert);
private:
void handleNewClientConnection(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Connection> c);
void handleSessionStarted(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession>);
void handleSessionFinished(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession>);
void handleElementReceived(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Element> element, SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> session);
void handleDataRead(const SafeByteArray&);
void handleDataWritten(const SafeByteArray&);
private:
IDGenerator idGenerator;
UserRegistry *userRegistry_;
int port_;
EventLoop* eventLoop;
NetworkFactories* networkFactories_;
bool stopping;
SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ConnectionServer> serverFromClientConnectionServer;
std::vector<SWIFTEN_SIGNAL_NAMESPACE::connection> serverFromClientConnectionServerSignalConnections;
std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> > serverFromClientSessions;
JID selfJID;
StanzaChannel *stanzaChannel_;
IQRouter *iqRouter_;
TLSServerContextFactory *tlsFactory;
CertificateWithKey::ref cert;
PlatformXMLParserFactory *parserFactory_;
std::string address_;
};
}
|