summaryrefslogtreecommitdiff
path: root/conn-notes.txt
blob: f4964829ac7c1854986b348c8ef338425a6d74a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Status of a tox friend netcrypto session.
-----------------------------------------
data ToxProgress
    = AwaitingDHTKey        -- ^ Waiting to receive their DHT key.
    | AcquiringIPAddress    -- ^ Searching DHT to obtain their node's IP & port.
    | AcquiringCookie       -- ^ Attempting to obtain a cookie.
    | AwaitingHandshake     -- ^ Waiting to receive a handshake.
    | AwaitingSessionPacket -- ^ Connection is "accepted" but not yet "confirmed".
    deriving (Eq,Ord,Enum,Show)


Information about concat toxid and events that provide it.
----------------------------------------------------------
	SockAddr
		receive packet with dhtkey associated with toxid
		receive query result with dhtkey associated with toxid
		receive netcrypto session packet from toxid
	DHTKey
		receive dhtpk over DataToRoute transport.
		receive dht message from SockAddr
		receive dhtpk via dht-request



Recurring tasks associated with obtaining a connection.
-------------------------------------------------------
while (account is active):
	announce{toxid}

	while (policy=TryingToConnect and friend session is not established)
		search{toxid} contact, send my dhtkey to results

		while (dhtkey is fresh but sockaddr is stale)
			search{node} dhtkey

		while (dhtkey and sockaddr are fresh)
			send handshake