Limit alternative sources
Moderator: Moderators
-
- Posts: 72
- Joined: 2004-01-23 14:45
Limit alternative sources
How can I limit max. alternative sources (in source code)???
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
-
- Posts: 72
- Joined: 2004-01-23 14:45
I have found this:
bool QueueManager::addSource(QueueItem* qi, const string& aFile, User::Ptr aUser, bool addBad) throw(QueueException, FileException) {
QueueItem::Source* s = NULL;
// if qi->getSources.getSize()<15
{
bool wantConnection = (qi->getPriority() != QueueItem::PAUSED);
if(qi->isSource(aUser, aFile)) {
but if I use if qi->getSources.getSize()<15 then it says SyntaxError: qi , but in other function it is normally used.
bool QueueManager::addSource(QueueItem* qi, const string& aFile, User::Ptr aUser, bool addBad) throw(QueueException, FileException) {
QueueItem::Source* s = NULL;
// if qi->getSources.getSize()<15
{
bool wantConnection = (qi->getPriority() != QueueItem::PAUSED);
if(qi->isSource(aUser, aFile)) {
but if I use if qi->getSources.getSize()<15 then it says SyntaxError: qi , but in other function it is normally used.
-
- Posts: 72
- Joined: 2004-01-23 14:45
Code: Select all
bool QueueManager::addSource(QueueItem* qi, const string& aFile, User::Ptr aUser, bool addBad) throw(QueueException, FileException) {
QueueItem::Source* s = NULL;
// if (qi->getSources.getSize()<15)
{
bool wantConnection = (qi->getPriority() != QueueItem::PAUSED);
if(qi->isSource(aUser, aFile)) {
-
- Posts: 72
- Joined: 2004-01-23 14:45
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Segmented downloading? Please, do not fucking do that.Big Muscle wrote:Now it works. I added it into onAction function. I am making segment downloading and if I use it, it adds 200 sources for file. Now it uses only 10 sources
You have to use hashes and verify against them to be safe. (And you don't seem like you're doing that.)
The last thing Direct Connect needs is corrupted files, and if your client corrupts transfers though a half-assed multi-source implentation, you will make a lot of people angry at you.
-
- Posts: 2
- Joined: 2004-01-28 05:25
- Location: Italy
- Contact:
Isn't it equally easy to get corrupted files by using the function which resumes a stopped d/l from a different source ?GargoyleMT wrote: You have to use hashes and verify against them to be safe. (And you don't seem like you're doing that.)
The last thing Direct Connect needs is corrupted files.
I'm quite new to DC++, but AFAIK it seems that it looks just at the file size to decide if a file is a valid alternative source.
I don't see what possible damage (regarding corrupt files) segmented d/l can do if compared to the present implementation.
Or am i missing something obvious ?
peace,
--
nerochiaro
--
nerochiaro
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
It is possible, assuming you write downloaded data to temp file per source (or keep other meta-data about what segments were downloaded from what source), and then overlap segments a bit, and do a "rollback-style" comparison on each. That, near as I can figure, is not how anyone has written their multi-source clone yet.psf8500 wrote:With segmented downloading this wont be possible.
(That still doesn't prevent in-line corruption of the transfer [such as a tree hash will detect], but those protections should ensure that corruption doesn't happen because you're downloading from incompatible sources.)