Skip to content

Commit

Permalink
Make Channels use DHT w/o Tunnels
Browse files Browse the repository at this point in the history
  • Loading branch information
ichorid committed Apr 9, 2020
1 parent 01d196d commit a5c10f7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ async def test_get_downloads_with_channels(self):

with db_session:
channel = self.session.mds.ChannelMetadata.create_channel(test_channel_name, 'bla')
def fake_get_metainfo(infohash, timeout=30):
def fake_get_metainfo(*args, **kwargs):
return succeed({b'info': {b'name': channel.dirname.encode('utf-8')}})
self.session.dlmgr.get_metainfo = fake_get_metainfo
ensure_future(self.session.gigachannel_manager.download_channel(channel))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ async def download_channel(self, channel):
dcfg.set_channel_download(True)
tdef = TorrentDefNoMetainfo(infohash=bytes(channel.infohash), name=channel.dirname)

metainfo = await self.session.dlmgr.get_metainfo(bytes(channel.infohash), timeout=60)
metainfo = await self.session.dlmgr.get_metainfo(bytes(channel.infohash), timeout=60, hops=0)
if metainfo is None:
# Timeout looking for the channel metainfo. Probably, there are no seeds.
# TODO: count the number of tries we had with the channel, so we can stop trying eventually
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import sys
from unittest import skipIf

from ipv8.database import database_blob

from pony.orm import db_session
Expand Down Expand Up @@ -48,7 +45,7 @@ async def test_channel_update_and_download(self):
self.session.mds.process_payload(payload)
channel = self.session.mds.ChannelMetadata.get(signature=payload.signature)

def fake_get_metainfo(infohash, timeout=30):
def fake_get_metainfo(*args, **kwargs):
return succeed({b'info': {b'name': channel.dirname.encode('utf-8')}})

self.session.dlmgr.get_metainfo = fake_get_metainfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ async def test_reject_malformed_channel(self):
self.mock_session.config.get_state_dir = lambda: None
self.mock_session.dlmgr = MockObject()

def mock_get_metainfo_bad(_, timeout=None):
def mock_get_metainfo_bad(*args, **kwargs):
return succeed({b'info': {b'name': b'bla'}})

def mock_get_metainfo_good(_, timeout=None):
def mock_get_metainfo_good(*args, **kwargs):
return succeed({b'info': {b'name': channel.dirname.encode('utf-8')}})

self.initiated_download = False
Expand Down

0 comments on commit a5c10f7

Please sign in to comment.