diff options
author | James Crayne <jim.crayne@gmail.com> | 2017-11-01 01:51:38 +0000 |
---|---|---|
committer | James Crayne <jim.crayne@gmail.com> | 2017-11-01 01:51:38 +0000 |
commit | 8db2baf3b4fc6b495e3988557a4db39ea9a531f8 (patch) | |
tree | 9756ff0e435d8af488bde0a13b595d01b1650b27 /examples/dhtd.hs | |
parent | afc322ec9fdb230feac94cbf62300ccb79b9bb42 (diff) |
DHTLinks... wip
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r-- | examples/dhtd.hs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index 931e1ba0..df36f5d8 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -131,6 +131,13 @@ data DHTAnnouncable = forall dta tok ni r. | |||
131 | , announceSendData :: dta -> tok -> Maybe ni -> IO (Maybe r) | 131 | , announceSendData :: dta -> tok -> Maybe ni -> IO (Maybe r) |
132 | } | 132 | } |
133 | 133 | ||
134 | data DHTLink = forall status linkid. (Show status, Typeable status, Show linkid, Typeable linkid) => DHTLink | ||
135 | { linkInit :: String -> IO (Either String status) | ||
136 | , linkStatus :: IO (Either String status) | ||
137 | , linkNewPipe :: String -> linkid -> IO (Either String status) | ||
138 | , linkUnPipe :: linkid -> IO (Either String status) | ||
139 | } | ||
140 | |||
134 | data DHTSearch nid ni = forall addr tok r. DHTSearch | 141 | data DHTSearch nid ni = forall addr tok r. DHTSearch |
135 | { searchThread :: ThreadId | 142 | { searchThread :: ThreadId |
136 | , searchState :: SearchState nid addr tok ni r | 143 | , searchState :: SearchState nid addr tok ni r |
@@ -161,6 +168,7 @@ data DHT = forall nid ni. ( Show ni | |||
161 | , dhtPing :: Map.Map String (DHTPing ni) | 168 | , dhtPing :: Map.Map String (DHTPing ni) |
162 | , dhtQuery :: Map.Map String (DHTQuery nid ni) | 169 | , dhtQuery :: Map.Map String (DHTQuery nid ni) |
163 | , dhtAnnouncables :: Map.Map String DHTAnnouncable | 170 | , dhtAnnouncables :: Map.Map String DHTAnnouncable |
171 | , dhtLinks :: Map.Map String DHTLink | ||
164 | , dhtParseId :: String -> Either String nid | 172 | , dhtParseId :: String -> Either String nid |
165 | , dhtSearches :: TVar (Map.Map (String,nid) (DHTSearch nid ni)) | 173 | , dhtSearches :: TVar (Map.Map (String,nid) (DHTSearch nid ni)) |
166 | , dhtFallbackNodes :: IO [ni] | 174 | , dhtFallbackNodes :: IO [ni] |
@@ -776,6 +784,9 @@ main = do | |||
776 | Just _ -> return Nothing | 784 | Just _ -> return Nothing |
777 | })] | 785 | })] |
778 | 786 | ||
787 | , dhtLinks = Map.fromList | ||
788 | [ {- TODO -} | ||
789 | ] | ||
779 | , dhtSecretKey = return Nothing | 790 | , dhtSecretKey = return Nothing |
780 | } | 791 | } |
781 | dhts = Map.fromList $ | 792 | dhts = Map.fromList $ |
@@ -892,6 +903,9 @@ main = do | |||
892 | chksum | 903 | chksum |
893 | return nospam | 904 | return nospam |
894 | })] | 905 | })] |
906 | , dhtLinks = Map.fromList | ||
907 | [ {- TODO -} | ||
908 | ] | ||
895 | , dhtSecretKey = return $ Just $ transportSecret (Tox.toxCryptoKeys tox) | 909 | , dhtSecretKey = return $ Just $ transportSecret (Tox.toxCryptoKeys tox) |
896 | } | 910 | } |
897 | dhts = Map.fromList $ | 911 | dhts = Map.fromList $ |