def __init__(self, *argv, **kwargs):
        from Tribler.community.privatesearch.community import PoliSearchCommunity

        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = PoliSearchCommunity

        self.manual_connect = False
        self.random_connect = False
        self.bootstrap_percentage = 1.0
        self.late_join = 0
        self.do_search = 1000
        self.search_limit = sys.maxint
        self.search_spacing = 15.0

        self.did_reply = set()
        self.test_set = set()
        self.test_reply = defaultdict(list)

        self.taste_buddies = {}
        self.not_connected_taste_buddies = set()
        self.file_availability = defaultdict(list)

        self.nr_search = 0

        self.community_kwargs['integrate_with_tribler'] = False
        self.community_kwargs['log_searches'] = self.log_searches
Beispiel #2
0
    def start_dispersy(self):
        DispersyExperimentScriptClient.start_dispersy(self)

        # as i'm cpu bound, lowering the number of bits of the elliptic curve
        self._my_member = self._dispersy.callback.call(self._dispersy.get_new_member, (u"NID_secp112r1",))

        self.community_args = (self._my_member,)
Beispiel #3
0
    def __init__(self, *argv, **kwargs):
        from Tribler.community.privatesocial.community import PoliSocialCommunity
        from Tribler.community.privatesemantic.community import PSI_OVERLAP
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = PoliSocialCommunity

        self.friends = set()
        self.not_connected_friends = set()
        self.foafs = set()
        self.not_connected_foafs = set()

        self.peercache = False
        self.nocache = False
        self.reconnect_to_friends = False
        self._mypref_db = None

        self.monitor_friends_lc = None
        self.prev_scenario_statistics = {}
        self.prev_scenario_debug = {}

        self.friendhashes = {}
        self.friendiphashes = {}
        self.foafiphashes = {}

        self.set_community_kwarg('integrate_with_tribler', False)
        self.set_community_kwarg('encryption', False)
        self.set_community_kwarg('max_prefs', 100)
        self.set_community_kwarg('max_fprefs', 100)
        self.set_community_kwarg('psi_mode', PSI_OVERLAP)
        self.set_community_kwarg('log_text', self.log_text)
Beispiel #4
0
    def __init__(self, *argv, **kwargs):
        from Tribler.community.privatesocial.community import PoliSocialCommunity
        from Tribler.community.privatesemantic.community import PSI_OVERLAP
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = PoliSocialCommunity

        self.friends = set()
        self.not_connected_friends = set()
        self.foafs = set()
        self.not_connected_foafs = set()

        self.peercache = False
        self.nocache = False
        self.reconnect_to_friends = False
        self._mypref_db = None

        self.monitor_friends_lc = None
        self.prev_scenario_statistics = {}
        self.prev_scenario_debug = {}

        self.friendhashes = {}
        self.friendiphashes = {}
        self.foafiphashes = {}

        self.set_community_kwarg('integrate_with_tribler', False)
        self.set_community_kwarg('encryption', False)
        self.set_community_kwarg('max_prefs', 100)
        self.set_community_kwarg('max_fprefs', 100)
        self.set_community_kwarg('psi_mode', PSI_OVERLAP)
        self.set_community_kwarg('log_text', self.log_text)
    def set_community_kwarg(self, key, value):
        from Tribler.community.privatesearch.oneswarm.community import PoliOneSwarmCommunity

        if key == 'use_megacache':
            value = self.str2bool(value)

        elif self.community_class != PoliOneSwarmCommunity:
            if key in ['ttl', 'neighbors', 'fneighbors']:
                value = self.str2tuple(value)
            elif key in ['max_prefs', 'max_fprefs']:
                value = int(value)
            elif key == 'prob':
                value = float(value)
            elif key == 'encryption':
                value = self.str2bool(value)
            else:
                return

        elif key == 'cancel_after':
            value = self.str2tuple(value)
        else:
            return

        DispersyExperimentScriptClient.set_community_kwarg(self, key, value)

        if DEBUG:
            print >> sys.stderr, "PrivateSearchClient: community_kwargs are now", self.community_kwargs
Beispiel #6
0
    def start_dispersy(self):
        DispersyExperimentScriptClient.start_dispersy(self)

        # as i'm cpu bound, lowering the number of bits of the elliptic curve
        self._my_member = self._dispersy.callback.call(
            self._dispersy.get_new_member, (u"NID_secp112r1", ))

        self.community_args = (self._my_member, )
Beispiel #7
0
    def online(self):
        sleep(random() * 5.0)

        DispersyExperimentScriptClient.online(self)

        # disable msimilarity requests
        self._orig_create_msimilarity_request = self._community.create_msimilarity_request
        self._community.create_msimilarity_request = lambda destination: False
Beispiel #8
0
    def __init__(self, *argv, **kwargs):
        from Tribler.community.metadata.community import MetadataCommunity
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = MetadataCommunity

        self.log_statistics_lc = None
        self.prev_scenario_statistics = {}

        self.set_community_kwarg('integrate_with_tribler', False)
    def __init__(self, *argv, **kwargs):
        from Tribler.community.allchannel.community import AllChannelCommunity
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = AllChannelCommunity
        self.my_channel = None
        self.joined_community = None
        self.torrentindex = 1

        self.set_community_kwarg('integrate_with_tribler', False)
Beispiel #10
0
    def start_dispersy(self):
        from Tribler.community.channel.preview import PreviewChannelCommunity
        from Tribler.community.channel.community import ChannelCommunity

        DispersyExperimentScriptClient.start_dispersy(self)
        self._dispersy.callback.call(self._dispersy.define_auto_load, (ChannelCommunity, (), {"integrate_with_tribler": False}))
        self._dispersy.callback.call(self._dispersy.define_auto_load, (PreviewChannelCommunity, (), {"integrate_with_tribler": False}))

        self.community_args = (self._my_member,)
Beispiel #11
0
    def __init__(self, *argv, **kwargs):
        from Tribler.community.allchannel.community import AllChannelCommunity
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = AllChannelCommunity
        self.my_channel = None
        self.joined_community = None
        self.torrentindex = 1

        self.set_community_kwarg('integrate_with_tribler', False)
Beispiel #12
0
    def start_dispersy(self):
        from Tribler.community.channel.preview import PreviewChannelCommunity
        from Tribler.community.channel.community import ChannelCommunity

        DispersyExperimentScriptClient.start_dispersy(self)
        self._dispersy.define_auto_load(ChannelCommunity, self._my_member, (),
                                        {"integrate_with_tribler": False})
        self._dispersy.define_auto_load(PreviewChannelCommunity,
                                        self._my_member, (),
                                        {"integrate_with_tribler": False})
Beispiel #13
0
    def set_community_kwarg(self, key, value):
        if key in ['max_prefs', 'max_fprefs']:
            value = int(value)
        elif key in ['encryption', 'send_simi_reveal']:
            value = self.str2bool(value)
        else:
            return

        DispersyExperimentScriptClient.set_community_kwarg(self, key, value)

        if DEBUG:
            print >> sys.stderr, "PrivateSearchClient: community_kwargs are now", self.community_kwargs
Beispiel #14
0
    def __init__(self, *argv, **kwargs):
        from dispersy.discovery.community import DiscoveryCommunity
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = DiscoveryCommunity

        self.friends = set()
        self.preferences = set()

        self.set_community_kwarg('max_prefs', sys.maxint)
        self.set_community_kwarg('max_tbs', 25)

        self.monitor_friends_lc = None
        self._prev_scenario_statistics = {}
        self._prev_scenario_debug = {}
Beispiel #15
0
    def __init__(self, *argv, **kwargs):
        from Tribler.community.privatesemantic.test import PoliFSemanticCommunity

        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = PoliFSemanticCommunity

        self.manual_connect = False
        self.random_connect = False
        self.bootstrap_percentage = 1.0
        self.late_join = 0

        self.taste_buddies = {}
        self.not_connected_taste_buddies = set()

        self.log_statistics_lc = None
        self.prev_scenario_statistics = {}
        self.prev_scenario_debug = {}

        self.community_kwargs['integrate_with_tribler'] = False
Beispiel #16
0
    def __init__(self, *argv, **kwargs):
        from Tribler.community.privatesocial.community import PoliSocialCommunity
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = PoliSocialCommunity

        self.friends = set()
        self.not_connected_friends = set()
        self.foafs = set()
        self.not_connected_foafs = set()

        self.peercache = False

        self.friendhashes = {}
        self.foafhashes = {}

        self.set_community_kwarg('integrate_with_tribler', False)
        self.set_community_kwarg('encryption', False)
        self.set_community_kwarg('max_prefs', 100)
        self.set_community_kwarg('max_fprefs', 100)
        self.set_community_kwarg('use_cardinality', False)
Beispiel #17
0
    def __init__(self, *argv, **kwargs):
        from Tribler.community.privatesocial.community import PoliSocialCommunity
        DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
        self.community_class = PoliSocialCommunity

        self.friends = set()
        self.not_connected_friends = set()
        self.foafs = set()
        self.not_connected_foafs = set()

        self.peercache = False

        self.friendhashes = {}
        self.foafhashes = {}

        self.set_community_kwarg('integrate_with_tribler', False)
        self.set_community_kwarg('encryption', False)
        self.set_community_kwarg('max_prefs', 100)
        self.set_community_kwarg('max_fprefs', 100)
        self.set_community_kwarg('use_cardinality', False)
Beispiel #18
0
    def online(self):
        if self.peercache:
            yield 30.0

        # if we're peercache -> enable send_simi_reveal, else disable
        self.set_community_kwarg('send_simi_reveal', self.peercache)

        DispersyExperimentScriptClient.online(self, dont_empty=True)
        self._orig_create_msimilarity_request = self._community.create_msimilarity_request

        if self._mypref_db:
            self._community._mypref_db = self._mypref_db

        if self.reconnect_to_friends:
            self._community.connect_to_peercache(sys.maxint)

            # we're going to allow this peer to connect to its friends for 5.0 seconds, then empty the buffer
            yield 5.0
        else:
            # if not reconnect_to_friends, connect_to_friend hasn't been called, hence
            # we disable simi requests
            self._community.create_msimilarity_request = lambda destination: False
        self.empty_buffer()
Beispiel #19
0
    def online(self):
        if self.peercache:
            yield 30.0

        # if we're peercache -> enable send_simi_reveal, else disable
        self.set_community_kwarg('send_simi_reveal', self.peercache)

        DispersyExperimentScriptClient.online(self, dont_empty=True)
        self._orig_create_msimilarity_request = self._community.create_msimilarity_request

        if self._mypref_db:
            self._community._mypref_db = self._mypref_db

        if self.reconnect_to_friends:
            self._community.connect_to_peercache(sys.maxint)

            # we're going to allow this peer to connect to its friends for 5.0 seconds, then empty the buffer
            yield 5.0
        else:
            # if not reconnect_to_friends, connect_to_friend hasn't been called, hence
            # we disable simi requests
            self._community.create_msimilarity_request = lambda destination: False
        self.empty_buffer()
Beispiel #20
0
    def offline(self):
        if self._community:
            self._mypref_db = self._community._mypref_db

        DispersyExperimentScriptClient.offline(self)
Beispiel #21
0
 def peertype(self, peertype):
     DispersyExperimentScriptClient.peertype(self, peertype)
     if peertype == "peercache":
         self.peercache = True
Beispiel #22
0
 def online(self):
     DispersyExperimentScriptClient.online(self)
     self._community.my_preferences = self.get_preferences
Beispiel #23
0
    def offline(self):
        if self._community:
            self._mypref_db = self._community._mypref_db

        DispersyExperimentScriptClient.offline(self)
Beispiel #24
0
    def online(self):
        DispersyExperimentScriptClient.online(self)

        if not self.log_statistics_lc:
            self.log_statistics_lc = lc = LoopingCall(self.log_statistics)
            lc.start(5.0, now=True)
Beispiel #25
0
 def start_dispersy(self, autoload_discovery=True):
     DispersyExperimentScriptClient.start_dispersy(self, autoload_discovery=False)
Beispiel #26
0
 def __init__(self, *argv, **kwargs):
     from Tribler.community.demers.community import DemersTest
     DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
     self.community_class = DemersTest
Beispiel #27
0
 def peertype(self, peertype):
     DispersyExperimentScriptClient.peertype(self, peertype)
     if peertype == "peercache":
         self.peercache = True
 def start_dispersy(self):
     DispersyExperimentScriptClient.start_dispersy(self)
     self.community_args = (self._my_member,)
Beispiel #29
0
 def __init__(self, *argv, **kwargs):
     from Tribler.community.demers.community import DemersTest
     DispersyExperimentScriptClient.__init__(self, *argv, **kwargs)
     self.community_class = DemersTest
Beispiel #30
0
    def online(self):
        DispersyExperimentScriptClient.online(self)

        # disable msimilarity requests
        self._orig_create_msimilarity_request = self._community.create_msimilarity_request
        self._community.create_msimilarity_request = lambda destination: False