summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/dht.c
Commit message (Collapse)AuthorAgeFilesLines
* ipcpd: Fix deadlock in DHTdimitri staessens2017-09-241-27/+41
| | | | | | | | | | | | | The lookup_update was waiting for the LU_INIT state to resolve under dht->lock which prevented that update. This PR fixes this bug, but leaves a (very rare) bug when the lookup_destroy is called while the lookup_update is waiting for the LU_INIT state to resolve. The solution also is a (harmless) lock inversion, but this is also not the best. Fixes #51 Fixes #52
* ipcpd: Add threadpool manager to DHTdimitri staessens2017-09-241-136/+203
| | | | | | | | | | | This adds a threadpool manager to the DHT. This was needed because the detached thread could cause a data race on shutdown. The threadpool manager is revised to allow multiple instances in a single program. The irmd and ipcp now store commands in a buffer (list) instead of a single buffer before passing it to handler threads.
* Merged in dstaesse/ouroboros/be-bugfixes (pull request #614)dimitri staessens2017-09-231-30/+85
|\ | | | | | | Some bugfixes
| * ipcpd: Don't publish DHT entries under lockdimitri staessens2017-09-231-30/+85
| |
* | Merged in dstaesse/ouroboros/be-bugfixes (pull request #613)dimitri staessens2017-09-231-7/+14
|\| | | | | | | Some bugfixes
| * ipcpd: Lock dht before reading parametersdimitri staessens2017-09-231-7/+14
| |
* | ipcpd: Fix DHT recursive lookupdimitri staessens2017-09-221-1/+4
|/
* lib: Pass the fuse struct to the handling threaddimitri staessens2017-09-211-1/+1
| | | | This avoids potential data races on rib.fuse.
* ipcpd: Handle DHT SDUs in different threaddimitri staessens2017-09-201-15/+58
| | | | | | | The DHT will now spawn a thread when receiving SDUs to avoid starvation of sdu scheduler threads. Also fixes some locking issues.
* Merged in dstaesse/ouroboros/be-dht-query-refuse (pull request #601)dimitri staessens2017-09-191-0/+3
|\ | | | | | | ipcpd: Refuse query when DHT not in running state
| * ipcpd: Refuse query when DHT not in running statedimitri staessens2017-09-191-0/+3
| |
* | ipcpd: Fix contact list in DHTdimitri staessens2017-09-191-3/+3
|/
* ipcpd: Enroll DHT when creating dt connectiondimitri staessens2017-09-191-16/+110
| | | | | | | | | The DHT will now enroll or sync when a data transfer connection is added. This avoids the need to create a temporary data transfer connection during enrollment (and speeds it up considerably). The notifier system was modified to take an opaque pointer to the object that registers as a parameter.
* ipcpd: Revise internals of normal IPCPdimitri staessens2017-09-121-7/+7
| | | | | | | | This removes the RIB as a datastructure and CDAP as the protocol between IPCPs. CDAP, the rib and related sources are deprecated. The link-state protocol policy is udpated to use its own protocol based on a simple broadcast strategy along a tree. The neighbors struct is deprecated and moved to the library as a generic notifier component.
* ipcpd: Shutdown DHT work thread first at destroydimitri staessens2017-09-071-6/+4
| | | | This prevents a potential deadlock on the wrlock.
* ipcpd: Fix missing unlock in dhtdimitri staessens2017-08-291-1/+2
|
* ipcpd: Fix state in dht lookup at lookup_waitdimitri staessens2017-08-291-16/+23
| | | | | | | | | | | The correct state was returned but not set internally in the lookup_struct, causing lookup_wait to return a lookup in LU_PENDING if the wait timedout. This also unlocks the IRMd during register calls and fixes some cleanup if lookup_wait gets interrupted. Fixes #48
* lib, ipcpd, irmd: Fix bugs reported by static analysisSander Vrijders2017-08-291-1/+2
| | | | This fixes several bugs as reported by the clang static analyzer.
* lib, ipcpd, irmd: Fix several memleaksSander Vrijders2017-08-231-1/+1
| | | | | This fixes several memleaks as reported by valgrind. It also fixes some calls to close() with -1.
* build: Revise the build systemdimitri staessens2017-08-211-1/+4
| | | | | | | | | | This revises the build system to have configuration per system component. System settings can now be set using cmake. The standard compliance defines were removed from configuration header and are set in the sources where needed. Also some small code refactors, such as moving the data for shims out of the ipcp structure to the respective shims were performed.
* build: Replace fsf snail mail with contact URLdimitri staessens2017-08-131-2/+1
|
* Merged in dstaesse/ouroboros/be-tpm (pull request #550)dimitri staessens2017-08-131-7/+28
|\ | | | | | | lib: Fix instability in threadpool manager
| * ipcpd: Fix tracking of outstanding DHT requestsdimitri staessens2017-08-131-7/+28
| | | | | | | | | | | | The DHT failed when receiving multiple responses in a short timeframe. The lookup struct now keeps track of the number of outstanding requests.
* | build: Fix compilation on OS X Sierradimitri staessens2017-08-111-0/+4
|/
* lib, ipcpd, tools: Fix enum assignmentsSander Vrijders2017-08-101-1/+1
| | | | This fixes several assignments to the wrong enum type.
* ipcpd: Fix finding values in DHTDimitri Staessens2017-08-051-5/+18
| | | | | | | | | The DHT lookup would stop if a node returned no new useful information (i.e. the value for the key or unknown nodes closer to the key) without waiting for other pending requests that could still return useful information. Now it correctly tracks the number of outstanding requests or returns if it doesn't get a response for KAD_T_RESP seconds. This fixes multi-hop flow allocation over the normal.
* ipcpd: Fix registration bug in DHTdimitri staessens2017-07-291-2/+2
|
* ipcpd: Some fixes in DHTdimitri staessens2017-07-291-13/+10
| | | | | | | Fixes a memory leak when the DHT is destroyed during a send_msg. Fixes a deadlock when destroying the DHT with a pending lookup. Removes some debug logs that clutter output due to expected redundant FIND_VALUE responses.
* ipcpd: Retry sending DHT response messagesdimitri staessens2017-07-241-4/+16
| | | | | | | This will make the remote retry sending responses when the DT component can't send the message. This is most useful at enrollment, when the remote's routing table may need to wait a bit on the routing component for a path to the new member,
* ipcpd: Fix DHT lookup processingdimitri staessens2017-07-201-20/+25
| | | | | Not all returned contacts were processed when a FIND_NODE or FIND_VALUE message was returned.
* ipcpd: Add DHT as directory in normal IPCPdimitri staessens2017-07-181-0/+2369
This implements a Distributed Hash Table (DHT) based on the Kademlia protocol, with default parameters set as used in the BitTorrent Mainline DHT. This initial implementation is almost feature complete, except for some things to be done after a testing period: caching and stale peer bumping, and setting the expiration timeout via the IRM tool.