summaryrefslogtreecommitdiff
path: root/conn-notes.txt
blob: 433e74b32695b51cc3ff4aeb9fb4785996fb7614 (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
41
42
43
44
45
46
47
48
49
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 contact 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):
	tox4id:announce{toxid}
	tox6id:

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

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

		while (dhtkey and sockaddr are fresh)
				(AcquiringCookie)
			getCookie { on timeout, consider sockaddr stale, set sockaddr to Nothing)
				(AwaitingHandshake)
			send handshake


On inbound
----------
	Handshake recieved!
		(AwaitingSessionPacket)