summaryrefslogtreecommitdiffstats
blob: 2fc2e766897a7c7ad642e141923b918aa7e14208 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * Copyright (c) 2015-2016 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#include <Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h>

#include <boost/bind.hpp>

#include <Swiften/FileTransfer/SOCKS5BytestreamServerManager.h>

namespace Swift {

SOCKS5BytestreamServerResourceUser::SOCKS5BytestreamServerResourceUser(SOCKS5BytestreamServerManager* s5bServerManager) : s5bServerManager_(s5bServerManager) {
    assert(!s5bServerManager_->isInitialized());
    onInitializedConnection_ = s5bServerManager_->onInitialized.connect(boost::bind(&SOCKS5BytestreamServerResourceUser::handleServerManagerInitialized, this, _1));
    s5bServerManager_->initialize();
}

SOCKS5BytestreamServerResourceUser::~SOCKS5BytestreamServerResourceUser() {
    if (s5bServerManager_->isInitialized()) {
        s5bServerManager_->stop();
    }
}

bool SOCKS5BytestreamServerResourceUser::isInitialized() const {
    return s5bServerManager_->isInitialized();
}

void SOCKS5BytestreamServerResourceUser::handleServerManagerInitialized(bool successfulInitialize) {
    onSuccessfulInitialized(successfulInitialize);
}

}