summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/Tox/Crypto/Transport.hs12
-rw-r--r--src/Network/Tox/DHT/Transport.hs8
2 files changed, 9 insertions, 11 deletions
diff --git a/src/Network/Tox/Crypto/Transport.hs b/src/Network/Tox/Crypto/Transport.hs
index 555164f2..1c641584 100644
--- a/src/Network/Tox/Crypto/Transport.hs
+++ b/src/Network/Tox/Crypto/Transport.hs
@@ -170,12 +170,12 @@ instance Sized HandshakeData where
170 170
171instance Serialize HandshakeData where 171instance Serialize HandshakeData where
172 get = HandshakeData <$> get 172 get = HandshakeData <$> get
173 <*> (id2key <$> get) 173 <*> getPublicKey
174 <*> (fromJust . digestFromByteString <$> getBytes 64) 174 <*> (fromJust . digestFromByteString <$> getBytes 64)
175 <*> get 175 <*> get
176 put (HandshakeData n k h c) = do 176 put (HandshakeData n k h c) = do
177 put n 177 put n
178 put $ key2id k 178 putPublicKey k
179 putByteString (convert h) 179 putByteString (convert h)
180 put c 180 put c
181 181
@@ -724,15 +724,15 @@ instance HasPeerNumber PeerInfo where
724instance Serialize PeerInfo where 724instance Serialize PeerInfo where
725 get = do 725 get = do
726 w16 <- get 726 w16 <- get
727 ukey <- id2key <$> get 727 ukey <- getPublicKey
728 dkey <- id2key <$> get 728 dkey <- getPublicKey
729 w8 <- get :: Get Word8 729 w8 <- get :: Get Word8
730 PeerInfo w16 ukey dkey <$> getBytes (fromIntegral w8) 730 PeerInfo w16 ukey dkey <$> getBytes (fromIntegral w8)
731 731
732 put (PeerInfo w16 ukey dkey bs) = do 732 put (PeerInfo w16 ukey dkey bs) = do
733 put w16 733 put w16
734 put $ key2id ukey 734 putPublicKey ukey
735 put $ key2id dkey 735 putPublicKey dkey
736 let sz :: Word8 736 let sz :: Word8
737 sz = case B.length bs of 737 sz = case B.length bs of
738 n | n <= 255 -> fromIntegral n 738 n | n <= 255 -> fromIntegral n
diff --git a/src/Network/Tox/DHT/Transport.hs b/src/Network/Tox/DHT/Transport.hs
index e784ec90..b9b63165 100644
--- a/src/Network/Tox/DHT/Transport.hs
+++ b/src/Network/Tox/DHT/Transport.hs
@@ -382,13 +382,11 @@ instance Sized CookieData where
382 size = ConstSize 72 382 size = ConstSize 72
383 383
384instance Serialize CookieData where 384instance Serialize CookieData where
385 get = CookieData <$> get 385 get = CookieData <$> get <*> getPublicKey <*> getPublicKey
386 <*> (id2key <$> get)
387 <*> (id2key <$> get)
388 put (CookieData tm userkey dhtkey) = do 386 put (CookieData tm userkey dhtkey) = do
389 put tm 387 put tm
390 put (key2id userkey) 388 putPublicKey userkey
391 put (key2id dhtkey) 389 putPublicKey userkey
392 390
393instance Sized CookieRequest where 391instance Sized CookieRequest where
394 size = ConstSize 64 -- 32 byte key + 32 byte padding 392 size = ConstSize 64 -- 32 byte key + 32 byte padding