Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   General Gnutella Development Discussion (https://www.gnutellaforums.com/general-gnutella-development-discussion/)
-   -   Trying to upload a file (https://www.gnutellaforums.com/general-gnutella-development-discussion/50075-trying-upload-file.html)

snayit December 19th, 2005 11:30 PM

Trying to upload a file
 
But i've encountered several problems that lead me to the conclusion that i am missing something here.

Right now my biggest problem is that sending queryHit with a different sha1 for the file (not the correct one, just one i made up) starts the DL, where as using the correct one (should be, i've calculated the sha1) give me "no sources" in gtk-gnutella and the DL won't start. Other than the sha1 - the queryHit is the same - but with the fake sha1 i also get the HTTP GET message that asks for the file and i don't get it using the real sha1.

The reason i'm doing that is to test calculating the sha1 for a file i already have - when using the fake sha1 after i finish DL (using both gtk-gnutella and Phex for DL the file from my program) - it gives me a message about wrong sha1 (of course, i made the sha1 up) and restarting DL. Now i wanted to check the correct sha1 - and expected not to see this message.

This is my biggest problem right now, please help.

Hyper-kun December 20th, 2005 12:29 AM

The problem might be that Gtk-Gnutella remembers the SHA1s of files it has downloaded before. That could cause the "no sources" issue if you try to run your test multiple times. Remove ~/gtk-gnutella/done.* or hack the sources to skip this check in src/core/ignore.c.

snayit December 20th, 2005 12:43 AM

Thanks for the response
 
But i have more info - the thing is more complex than what i thought:
My sha1 as i calculated it is: 3IRE53N5YXBD2AFSPHPWPMINI53O63DB.
If i change the first I to R or T - it works! meaning the only thing that does not work for me is this particular sha1 or something.

Also - this happens in LimeWire as well. I have the code on my Eclipse so i can debug it and see why the sha1 i've calculated using the LW/FW's code does not work (meaning it does not send me the GET message) but if i destroy it (change it randomally) - it does.

Any thoughts? Maybe where to look in the code (i'm starting digging, i'll see what i come up with).

Hyper-kun December 20th, 2005 12:59 AM

Try a file consisting of 500 NUL bytes. What urn:sha1 do you get?

snayit December 20th, 2005 01:10 AM

I tried what you said
 
I printed this buffer - 500 times 0 that i've created like this:
ByteBuffer buffer = ByteBuffer.allocate(500);
printed to a file, than i asked my method call to generate sha1 for this and the result is: 7RLNJM6HFKF74WJTOPDUBVKY5QJUBLDT
Is it okay?

Other than that, i don't understand - if i faked a sha1 it asks for the file and if i give it the sha1 the i generated i don't? why is the fake better than the calculated one?

Hyper-kun December 20th, 2005 01:17 AM

Yes, the SHA1 one is correct. If you share this file and report it in a query hit, there's no attempt at all to download it?

snayit December 20th, 2005 01:33 AM

See?! now i've inserted the sha1 of the nulls
 
and still it asked me the file. I change only the sha1 to the one for the file with the nulls and i got a request:
GET /uri-res/N2R?urn:sha1:7RLNJM6HFKF74WJTOPDUBVKY5QJUBLDT HTTP/1.1

Why when i change the sha1 to the URN for the real file it doesn't request anything? it doesn't check for validation, so what's wrong?
Again, the only thing i change is the sha1 string - nothing else.

Hyper-kun December 20th, 2005 01:42 AM

Gtk-Gnutella - and the same applies probably to most clients - won't download files you share respectively already own. Maybe that's the reason?

snayit December 20th, 2005 01:48 AM

No - every time i try it's the same file name
 
the only thing i change in the queryHit is the sha1 - i change letters and sometimes the whole sha1. It allows me to DL the same file over and over again - just when i double click on the search result with the calculated sha1 it doesn't send me the GET request - only with the sha1 i stated in my msg. Every other sha1 i insert is ok for the clients.

I will now search in FW/LW's code what happens after i double click the file name from the search result - and take it from there. If anyone can help i'll be gratefull.

Hyper-kun December 20th, 2005 01:57 AM

For what it's worth, the file is badly encoded or recorded.


All times are GMT -7. The time now is 08:52 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.