mirror of https://github.com/voidlizard/hbs2
threaded download
This commit is contained in:
parent
c2cefea9a3
commit
3550d8d624
|
@ -141,6 +141,7 @@ data PeerTraceKey
|
||||||
data PeerTrace1Key
|
data PeerTrace1Key
|
||||||
data PeerProxyFetchKey
|
data PeerProxyFetchKey
|
||||||
data PeerTcpSOCKS5
|
data PeerTcpSOCKS5
|
||||||
|
data PeerDownloadThreadKey
|
||||||
|
|
||||||
|
|
||||||
instance Monad m => HasCfgKey PeerDebugKey a m where
|
instance Monad m => HasCfgKey PeerDebugKey a m where
|
||||||
|
@ -170,6 +171,9 @@ instance Monad m => HasCfgKey PeerProxyFetchKey (Set String) m where
|
||||||
instance Monad m => HasCfgKey PeerTcpSOCKS5 (Maybe String) m where
|
instance Monad m => HasCfgKey PeerTcpSOCKS5 (Maybe String) m where
|
||||||
key = "tcp.socks5"
|
key = "tcp.socks5"
|
||||||
|
|
||||||
|
instance Monad m => HasCfgKey PeerDownloadThreadKey (Maybe Int) m where
|
||||||
|
key = "download-threads"
|
||||||
|
|
||||||
data PeerOpts =
|
data PeerOpts =
|
||||||
PeerOpts
|
PeerOpts
|
||||||
{ _storage :: Maybe StoragePrefix
|
{ _storage :: Maybe StoragePrefix
|
||||||
|
@ -642,6 +646,8 @@ runPeer opts = Exception.handle (\e -> myException e
|
||||||
let tcpProbeWait = runReader (cfgValue @PeerTcpProbeWaitKey) syn
|
let tcpProbeWait = runReader (cfgValue @PeerTcpProbeWaitKey) syn
|
||||||
& fromInteger @(Timeout 'Seconds) . fromMaybe 300
|
& fromInteger @(Timeout 'Seconds) . fromMaybe 300
|
||||||
|
|
||||||
|
let downloadThreadNum = runReader (cfgValue @PeerDownloadThreadKey) syn & fromMaybe 2
|
||||||
|
|
||||||
let useSocks5 = runReader (cfgValue @PeerTcpSOCKS5) syn
|
let useSocks5 = runReader (cfgValue @PeerTcpSOCKS5) syn
|
||||||
|
|
||||||
let listenSa = view listenOn opts <|> listenConf <|> Just "0.0.0.0:7351"
|
let listenSa = view listenOn opts <|> listenConf <|> Just "0.0.0.0:7351"
|
||||||
|
@ -1019,7 +1025,8 @@ runPeer opts = Exception.handle (\e -> myException e
|
||||||
|
|
||||||
peerThread "pexLoop" (pexLoop @e brains tcp)
|
peerThread "pexLoop" (pexLoop @e brains tcp)
|
||||||
|
|
||||||
peerThread "blockDownloadLoop" (blockDownloadLoop denv)
|
replicateM_ downloadThreadNum do
|
||||||
|
peerThread "blockDownloadLoop" (blockDownloadLoop denv)
|
||||||
|
|
||||||
peerThread "blockDownloadQ" (downloadQueue conf (SomeBrains brains) denv)
|
peerThread "blockDownloadQ" (downloadQueue conf (SomeBrains brains) denv)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue