Commit Graph

102 Commits

Author SHA1 Message Date
drbob
62176264d3 added single function to call dht, with thread cleanup.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5954 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-12-09 13:19:28 +00:00
drbob
1a1e453c7e Modified previous example into a Single Shot Search for RPC support.
Takes 2 - 3 minutes to run at the moment. Got to make it faster!



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5732 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-10-28 14:21:58 +00:00
drbob
72d3c868e3 Tweaks to bitdht library for standalone single search option.
- Added flag to disable local Network search.
 - Fixed DHT Msg Rate bug (ported from trunk).



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5731 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-10-28 14:10:56 +00:00
thunder2
2367653146 Fixed crash when using rs_sprintf/bd_sprintf or rs_sprintf_append/bd_sprintf_append with empty result (maybe only on Windows).
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5349 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-07-29 13:28:45 +00:00
drbob
ede890417e Changes to make libbitdht compile on OSX.
- changed <malloc.h> => <stdlib.h>
	- put #ifdef __cplusplus protection in bdstring.h so it can be used by C modules.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5231 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-06-19 10:36:48 +00:00
thunder2
443703e61f Switched back to not optimized compile on Windows.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5178 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-05-21 19:06:16 +00:00
csoler
16501f62dd fixed bug probably responsible for random crashes in DHT code
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5138 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-05-03 19:29:38 +00:00
thunder2
9df55782a3 Switched on optimized compile on Windows.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5136 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-05-03 14:33:34 +00:00
thunder2
a6dfac2a37 Removed std::stringstream.
Removed not necessary include <sstream>.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5112 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-04-19 22:10:00 +00:00
thunder2
4e26884646 Removed some std::ostringstream.
To be continued.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5111 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-04-19 20:44:32 +00:00
thunder2
3b85873313 Added patch from AC
- add missing includes "unistd.h" for compiling with gcc 4.7.0.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5096 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-04-12 23:29:39 +00:00
thunder2
0b1126babf Added thread safe function for inet_ntoa in libbitdht.
Used the existing thread safe function for inet_ntoa in libretroshare.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5033 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-03-18 01:33:25 +00:00
thunder2
970d88200d Removed some more compiler warnings from Windows compile (GCC 4.4).
Added -Wextra to the Windows compile.
Added new define in libbitdht for snprintf and fprintf to proper handling of "%ll" under Windows.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4951 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-02-17 10:03:38 +00:00
drbob
4e5e149a95 Patch from Peter - to build Retroshare on FreeBSD.
- Fixup BSD qmake parameters: mainly library locations.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4863 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-29 14:27:14 +00:00
drbob
f08bcc153e * Disabled Thread debugging.
* Fixed up bdProxyId initialisation
 * Improved Error Code translation (for unknown entries)



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4826 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-20 17:30:16 +00:00
drbob
6b2a6e771b disabled more debug output.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4825 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-20 15:23:44 +00:00
drbob
c05f90bda3 Introduced tracking of Source & ErrCodes associated with every Proxy / Relay connection.
- This is mainly for algorithm improvements / debugging.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4823 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-20 15:12:02 +00:00
drbob
7dc0cd6b0f Added Send/Recv accounting to Dht & UdpSocket in general.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4817 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-19 16:18:59 +00:00
drbob
66f6c08f33 Missed default size for new bdDhtFns.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4797 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-14 09:44:40 +00:00
drbob
fe955c9a4f * Added NumQueryNodes() function to bdDhtFunctions.
* Switched bdquery.cc to use bdNumQueryNodes().
 * Extended bdStdDht class to bdModDht to allow NodesPerBucket to be modified.
 * Fixed up Connection Fail Callback for Relay Servers.
 * Added Extra debugging for Proxy Connections.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4794 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-14 01:34:44 +00:00
drbob
9e5e07d3f0 Reversed Changes for Testing Purposes.
* Disabled lots of debugging.
 * Disabled LOCAL test mode in udpstunner, rsinit
 * Enabled BadPeer checking in bitdht.
 * Restored normal timeout periods for connection attempts.
 * Restored normal connection levels for dht status.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4779 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-11 10:24:37 +00:00
drbob
f20ac8630e Upgraded DHT Version number from 01 => 02, for Relay Connections.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4776 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-10 23:24:53 +00:00
drbob
e432d89310 Improved the proxy/relay selection.
Limited Search Replies on Relay Servers.
NB: Re-check this code!



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4766 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-08 16:14:40 +00:00
drbob
2b7499e61d More changes for debugging
* Enabled lots of debugging.
 * Switched to shorter timeouts for udprelays.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4763 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-08 10:50:33 +00:00
drbob
af5f23e0e7 Changes to enable a LAN Relay Test Environment.
NB: Reverse Most of these changes - before adding to Trunk!!!!

 * Added missing BitDht callback functions for test/example code.
 * Switch tests/example to OSX compile.
 * DISABLE_BAD_PEER_FILTER (as it doesn't like local net)
 * Reduced Minimum Peer Counts for DHT to be considered active.
 * Added LOCALNET_TESTING to rsinit.cc 
	- new Commandline Option -R <lport-uport> to restrict UDP ports.
	- Enables LocalNet in UdpStunner.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4756 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2012-01-07 11:28:00 +00:00
drbob
8e5e90dcef Adding header for new proxy udp configuration
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4732 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-12-20 10:42:02 +00:00
drbob
52e9a27f7b Improvements to DHT to support Relays.
- Updated DhtMode Flags.
 - Allowed DhtMode Flags to be set independently.
 - Set RelayMode to ConnectionManager.
 - Added dropRelayServers() / pingRelayServers()
 - Added Support fns for above two functions.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4729 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-12-20 02:03:25 +00:00
drbob
b6dbdf9396 Improvements to BadPeer Filter.
* Enabling Local BadPeer Filter. 
	- This will remove any peer you detect is spoofing yourself or your friends.
	- This list is also shared with you friends. (in Test Mode).
 * added Cleanup of BadPeer Filter.
	- Instead of permanent ban, peers are be banned for 6 hours.
	- bdManager periodically calls this - which prints out ban list too.
 * added #define to disable the Filter - for testing purposes.

NOTES: This Ip Filter should probably be moved from DHT level to UdpLayer level.
	This will enable it to filter STUN / UDP Connection Packets too.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4716 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-12-08 20:00:20 +00:00
drbob
ed18152596 * Reduced DHT default msg rate to 5/sec. (was 50/sec)
- At this level it takes significantly longer for the searches to complete, but
	  there are no DOS warnings on the router. This should hopefully make users happy.
 * Added DhtMode() Interface call to dynamically change this rate.
	- Can be switched between (HIGH: 50/sec, MED: 20/sec, LOW: 5/sec & TRICKLE: 3/sec)
 * Disable additional Queries if PotentialPeer Queue gets too big.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4703 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-12-01 17:19:30 +00:00
drbob
8d4a7ed4f0 Improvements to the Bad Peer tracking in the DHT.
* Added Interfaces for sharing Bad Peers.
 * Added bdPeerQueue class for storing
 * added doInfoCallback() to inform libretroshare



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4686 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-11-25 00:48:33 +00:00
drbob
4cd7523947 Incremental Improvements to DHT:
Added Knowledge of Friends, Friends of Friends and Relays.
	- Added bdfriendlist class to store information.
	- New interface function updateKnownPeer().
	- includes IP addresses, if known. (for filtering)

Bad Peer Filtering.
	- Check IDs against known peer IP addresses.
	- Added checks in checkPotentialPeer().
	- Added checks in addPeer().
	- Running in TestMode at the moment (Bad Peers are only flagged).

Other Fixes:
	- Removed some warning about int/uint comparisons.
	- added bdSpace::flagpeer() fn to support above.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-dhtmods@4680 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-11-22 13:16:03 +00:00
drbob
5ea8cfb67d Added Ben's patches:
* Compilation for FreeBSD.
	* Notes that MT is not cryptographically secure.
	* modified sorting of DHT Window.

Only one change that I didn't commit:

 bitdht {
-       LIBS += ../../libbitdht/src/lib/libbitdht.a
-       PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
+       LIBS += ../../libbitdht/src/libbitdht.a
+       PRE_TARGETDEPS *= ../../libbitdht/src/libbitdht.a
 }

As this would have broken compilation on the other platforms.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4619 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-09-28 15:16:21 +00:00
thunder2
27842b8592 Removed unused parameter warnings in libbitdht.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4557 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-08-12 12:43:24 +00:00
drbob
f6002b3981 Added External Interface to control "Attached" Mode
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4483 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-21 11:23:56 +00:00
csoler
a683b64311 fixed compilation on ubuntu
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4481 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-20 17:56:49 +00:00
drbob
6e6767be30 * Added another Test UdpLayer: TimedUdpLayer, This simulates the firewalled situation, be only accepting packets after 60 seconds.
* added quick and dirty BitDht Packet check. test against "d1:" for the first 3 bytes. This should not conflict with Stun, Relay or TOU packets.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4480 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-20 17:04:44 +00:00
drbob
e7049cc483 * #defined most of the Debugging info out.
* increased bdconnection timeout.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4468 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-18 23:52:23 +00:00
drbob
551e2594bb Added Bandwidth and Delay parameters to BitDHT Connect Messages.
* Bandwidth are for RELAY connections.
 * Delays are for Exclusive NAT Proxy connections.
 * Lots of changes to achieve this. (Mainly added "param" to msgs).
 * Various Bugfixes too.
 * Updated BITDHT Version to 01 as we've changed Message Format.
 * Increased Connection Timeout to 180 
 * Added extra checks to kill duplicate connections early.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4462 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-17 23:29:53 +00:00
drbob
a63173b19e Modified the Connections so that occur as quickly as possible.
Each attempt should be completeable in < 10 Secs. 
This could increase up to 20 secs, if pings are required.
So with 3 Proxy attempts, should take 20-30 secs.

 * Removed as many of the pauses as possible.
 * connection attempt DONE if OUTOFPROXY, DUPLICATE, TEMPUNAVAIL or EXTCONNECT timeout
 * Fixed AutoAuth for Proxy (was triggering for Relay as well)
 * Increased QUERY_UPDATES to every 10 secs.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4454 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-16 12:57:11 +00:00
drbob
6609cec94d Bugfixes for connection logic:
* added bool return value to ConnectionRequest. only returns false if MODE not allowed.
 * added checks for an existingConnectionRequest - results in a NOOP.
 * made each ConnectionRequest result in only one UDP start.
 * a START message will not kill a local ConnectionRequest (even in remotely started).
 * increased CONNECTION_TIMEOUT as this should never happen at this level.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4449 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-15 16:02:56 +00:00
drbob
d6938721b0 Reduced timeout for connections to 20 secs. because they should be quick.
Made the query more robust, by only saying a query is SUCCESSFUL if we have recvd a reply from peer.
NB: These changes are yet to be tested!



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4439 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-13 11:37:47 +00:00
drbob
21145a29bb * added function to extract Local Address from udpstack.
* update local address when a reset is called.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-netupgrade@4417 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-10 00:37:09 +00:00
drbob
5e691935fd Merged from /branches/v0.5-peernet/libbitdht:r4357-4397
Bugfixes and a couple of small improvements to the DHT code.
 * fixed up buggy overloading for the udplayer (for testing).
 * added processing multiple (5) remote processes per tick. 
     - (1 wasn't enough in testing, and led to dropped peers) 
 * removed unused variables from query data structure.
 * #defined out debugging in bdSpace, removed old functions.
 * More agressive attempts to find proxies for connections.
 * made "final query attempt" use exact peer address rather than midid.
     - mid id meant that the target wasn't always returned.
 * tweaked bdconnection debugging.
 * increase CONNECTION_MAX_TIMEOUT from 30 => 45. wasn't enough!
 * Limited bdQuery::QueryIdlePeriod to 15min (was unlimited).
 * added bdQuery::PotentialPeer cleanup functions - for more robust reporting.
 * fixed bdQuery debugging printouts.
 * Implemented BITDHT_QFLAGS_UPDATES flag.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4398 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-06 00:14:58 +00:00
drbob
24351cb460 * added #define WIN32 protection for <malloc> in bdbloom
* disabled ATTACHED mode by default.
 * set reasonable default Startup parameters (had test ones before)



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4397 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-07-05 23:53:40 +00:00
csoler
04ce05025f fixed linux compilation
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4362 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-06-29 19:13:39 +00:00
thunder2
e6062f4513 Fixed compile on Windows.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4361 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-06-29 19:05:03 +00:00
drbob
96ce8e9103 Restarted BitDHT official numbering.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4360 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-06-29 18:05:42 +00:00
drbob
79b48d5a89 Merging from branches/v0.5-peernet/libbitdht (--- Merging r4354 through r4356 into '.')
* adding Bloom filter to speed up finding RS peers.
 * fixed startup bug. (loops into FAILURE)




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4357 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-06-29 16:06:33 +00:00
drbob
fff40eceac Merging branches/v0.5-peernet/libbitdht (Merging r4237 through r4353 into '.')
There are many significant improvements to the DHT here. 
See commit logs on v0.5-peernet branch for details.

This is not the final merge, but brings over the majority of expected v0.5-peernet/libbitdht changes 




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4354 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-06-29 10:46:11 +00:00
defnax
f517442989 added win32 build bat for libbitdht
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4352 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2011-06-28 21:09:07 +00:00