Commit Graph

268 Commits

Author SHA1 Message Date
Arvid Norberg 7251575d98 This patch does: (#633)
1. simplifies and regularizies creation of listen sockets based on the listen
   interfaces setting.
2. simplifies and improves the behavior of UDP sockets, which are now explicitly
   opened per listen interface
3. transitions udp tracker, DHT and uTP socket manager over to using the new
   udp sockets
4. greatly simplified udp_socket to only wrap a single underlying socket (as
   opposed to one IPv4 and IPv6 socket)
5. improved behavior of bind-to-device
6. introduce an array_view type to make udp packet passing code simpler
7. simplify and make setting of DF flag more robust
8. simplify and regularize port mapping of listen sockets
2016-04-24 15:26:28 -04:00
arvidn d17ae19391 Merge branch 'RC_1_1' 2016-04-11 02:08:06 -04:00
arvidn 08edf43b3f fix to documentation generation to exclude private functions. fix makefile errors 2016-04-09 00:33:26 -04:00
arvidn 6d85c7c5f0 merge RC_1_1 into master 2016-03-08 01:10:48 -05:00
Alden Torres 4998bfedc6 Documentation typos 2016-03-04 10:43:25 -05:00
arvidn 3842a0a197 Merge branch 'RC_1_1' 2016-02-12 15:43:13 -05:00
Alden Torres feb2fd34d6 Documentation typos and new lines 2016-02-11 19:53:43 -05:00
arvidn d5203c67d9 add DHT rate limit test (simulation). introduce a new counter for dropped incoming dht messages. 2016-01-18 14:34:42 -05:00
arvidn 06b52f1421 some cleanup of the dht_socket_interface and fix tests and simulations to build with the dht disabled 2016-01-18 14:34:42 -05:00
arvidn 297b8943d0 move the DHT rate limiter into the dht_tracker class and remove the rate_limited_udp_socket type. This further simplifies the udp socket (preparing for moving it into the listen_socket structure) 2016-01-18 14:34:41 -05:00
arvidn 1f9f588e75 merge copyright year update and changelog from RC_1_0 2016-01-17 18:57:46 -05:00
arvidn 651b473908 add unit test for routing_table::update_node_id 2016-01-11 23:47:27 -05:00
arvidn f4d643bd2d instead of restarting the whole DHT when changing external IP, just rebuild the routing table and change the node IDs 2016-01-11 21:17:25 -05:00
arvidn e3ba811ae4 improve name of m_timer in dht_tracker 2016-01-01 16:42:44 -05:00
arvidn 01e6b93854 simplify and improve unit test for distance_exp. make some immutable variables const in the DHT implementation. instead of waking up periodically just to check if it's time to refresh the DHT secret key, set the timer to only wake up to refresh the key. If we don't have a DHT observer (to ask for our external IP) or if we don't know our external IP, don't generate a node ID based on 0.0.0.0, just generate a random ID instead. Simplified and improved node replacement logic in the routing table a little bit 2016-01-01 16:42:37 -05:00
Arvid Norberg ffb78f0378 Merge pull request #312 from ssiloti/export-verify-message
export verify_message and incoming_error
2015-12-30 22:51:38 -05:00
Steven Siloti 30076218f8 entry is a class not a struct 2015-12-30 17:25:00 -08:00
Steven Siloti ac01ccc43a add templated wrapper around verify_message
It was too easy to forget to update the ret and size parameters
when the size of desec changed. With this change we now automatically
get the size of desc and enforce that ret has the same size.

It would be nice if we could use bdecode_node ret[static Size] from C99
but that is not widely supported.
2015-12-29 20:35:36 -08:00
arvidn 505ae508f4 mark up some override functions and fix other clang warnings 2015-12-13 19:44:42 -05:00
Steven Siloti c6f1e0bd7b export verify_message and incoming_error
Also move these functions to a new msg.cpp. They are useful for plugins
which implement DHT extensions.
2015-12-05 18:20:08 -08:00
arvidn 98c9ac0448 fix msvc build 2015-12-03 19:28:57 -05:00
arvidn 69f4e94995 null_observer is used in a test now 2015-12-03 07:51:53 -05:00
arvidn 12dde0f415 actually add a test to the unit test 2015-11-30 19:07:35 -05:00
arvidn 332799bff2 make alert types declared final and disable the log alert declarations when logging is disabled 2015-11-29 10:16:02 -05:00
Steven Siloti 9c7edf803e add override and a TODO 2015-11-22 18:58:32 -08:00
Steven Siloti 9f7aa7f3a6 fix segfault in put_data
If less than three nodes are found to put an item to then traversal_algorithm::start
will add router nodes. This leads to a crash in put_data::invoke when it tries to
read a token from uninitialized memory in a null_observer.
2015-11-22 16:05:24 -08:00
Steven Siloti 1f13343a70 const correctness 2015-11-22 10:02:26 -08:00
Arvid Norberg 42b129b9d5 Merge pull request #178 from thomas-yuan/put
Make dht_put_alert more accurate.
2015-11-21 02:30:45 -05:00
Thomas Yuan ab70ad3e05 fix comments and unit test 2015-11-20 00:06:08 -05:00
Thomas Yuan 194ad410dc Make dht_put_alert more accurate. 2015-11-20 00:06:08 -05:00
arvidn fba0762353 fix some msvc warnings 2015-11-19 19:01:54 -05:00
Steven Siloti c2277b3ea5 fix traversal_algorithm::done() being invoked more than once
A traversal can be done while there are still outstanding queries (i.e.
m_invoke_count is non-zero) if K good responses have already been received and
none of the outstanding queries are closer than the nodes which have responded.

When this happens and the outstanding queries eventually complete or timeout
they call traversal_algorithm::failed() or traversal_algorithm::finished() as
usual which will cause traversal_algorithm::done() to be called yet again.

The fix is to always set the done flag on all queried observers in
traversal_algorithm::done() so that the observers will refrain from calling
back into the traversal.

This also makes traversal_algorithm::abort() redundant since this was the only
thing it did before it called into done().
2015-11-09 20:47:33 -08:00
arvidn 3cc464805f update libsimulator submodule 2015-10-25 10:55:20 -04:00
arvidn 74ee06bff7 add more override annotation 2015-10-17 02:20:38 -04:00
Alden Torres cf4c8d0058 Minor refactor in direct_traversal and some typos in bdecode header. 2015-10-08 09:15:16 -04:00
arvidn 41b8429cd1 clean up documentation makefile and documentation generation script 2015-10-07 00:48:43 -04:00
Alden Torres 62b24d8b67 Add set_dht_storage to session API. 2015-10-02 09:00:07 -04:00
Thomas Yuan f9fa8ffdec Use ping instead of get_peers if current bucket is full. 2015-09-22 10:35:10 -04:00
Alden Torres 25ed70b977 Create dht_storage_counters to avoid internal counter in future public API. 2015-09-21 07:46:23 -04:00
Alden Torres e2d682275a Implementing and using new dht storage interface 2015-09-16 08:30:27 -04:00
Thomas Yuan bee620b4f1 Fix routing_table bucket_size(int bucket) out_of_range logic error. 2015-09-10 17:19:00 -04:00
Thomas Yuan d6bb387ab9 Use dht_settings directly instead of add a read_only member variable.
Since rpc_manager has a reference of dht_settings, needn't pass it
as a parameter for incoming().
2015-09-08 10:35:30 -04:00
Thomas Yuan 3d4ed9f37f Add read-only support in dht_settings and outgoing query messages. 2015-09-07 14:24:46 -04:00
arvidn 17c5759829 disable warning for unused command line argument and fix warnings. remove redundant travis build config. use new preprocessor on clang to avoid warnings 2015-09-06 22:55:41 -04:00
Thomas Yuan ef16ae4e27 Handle response with unexpected format. 2015-08-31 22:37:46 -04:00
Thomas Yuan b26d08c66a Remove unnecessary selection statements. 2015-08-26 11:26:21 -04:00
arvidn ffa870d280 fixed some GCC warnings 2015-08-20 01:33:20 +02:00
arvidn a3608a39fe fix some warnings 2015-08-19 02:00:46 +02:00
arvidn 347d976a70 since starting the DHT can be delayed now, also cache dht nodes added while waiting 2015-08-18 23:35:27 +02:00
arvidn 8d8c049d9e fix warnings and invalid defines in disk_io_thread.cpp 2015-08-18 07:55:50 -04:00