Skip to content

Commit

Permalink
update pinned + fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lchenut committed Oct 24, 2023
1 parent c6460ea commit f350479
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .pinned
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ serialization;https://github.com/status-im/nim-serialization@#4bdbc29e54fe540499
stew;https://github.com/status-im/nim-stew@#3159137d9a3110edb4024145ce0ba778975de40e
testutils;https://github.com/status-im/nim-testutils@#dfc4c1b39f9ded9baf6365014de2b4bfb4dafc34
unittest2;https://github.com/status-im/nim-unittest2@#2300fa9924a76e6c96bc4ea79d043e3a0f27120c
webrtc;https://github.com/status-im/nim-webrtc.git@#0504d863407c1d14bf39478ba2335d299caac6ef
webrtc;https://github.com/status-im/nim-webrtc.git@#a36708a5a0103f7dbbca85f7021eab864cc6cca0
websock;https://github.com/status-im/nim-websock@#f8ed9b40a5ff27ad02a3c237c4905b0924e3f982
zlib;https://github.com/status-im/nim-zlib@#a2f44bb7f65571a894227ff6fde9298a104e03a5
17 changes: 9 additions & 8 deletions libp2p/transports/webrtctransport.nim
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import transport,
../errors,
../wire,
../multicodec,
../multihash,
../multibase,
../protobuf/minprotobuf,
../connmanager,
../muxers/muxer,
Expand All @@ -28,7 +30,7 @@ import transport,
../protocols/secure/noise,
../utility

import webrtc/webrtc, webrtc/datachannel
import webrtc/webrtc, webrtc/datachannel, webrtc/dtls/dtls

logScope:
topics = "libp2p webrtctransport"
Expand Down Expand Up @@ -345,10 +347,12 @@ method start*(
self.servers &= server

let
cert = server.dtlsLocalCertificate()
cert = server.dtls.localCertificate()
certHash = MultiHash.digest("sha2-256", cert).get().data.buffer
encodedCertHash = MultiBase.encode("base64", certHash).get()
self.addrs[i] = (MultiAddress.init(server.udp.laddr, IPPROTO_UDP).tryGet() & MultiAddress.init(multiCodec("webrtc-direct")).tryGet() & MultiAddress.init(multiCodec("cert-hash"), encodedCertHash).tryGet()).tryGet()
self.addrs[i] = MultiAddress.init(server.udp.laddr, IPPROTO_UDP).tryGet() &
MultiAddress.init(multiCodec("webrtc-direct")).tryGet() &
MultiAddress.init(multiCodec("certhash"), certHash).tryGet()

trace "Listening on", address = self.addrs[i]

Expand Down Expand Up @@ -377,17 +381,14 @@ proc connHandler(self: WebRtcTransport,
for f in futs:
if not f.finished: await f.cancelAndWait() # cancel outstanding join()

trace "Cleaning up client", addrs = $client.remoteAddress,
conn
trace "Cleaning up client"# TODO ?: , addrs = $client.remoteAddress,
# conn

self.clients[dir].keepItIf( it != client )
#TODO
#await allFuturesThrowing(
# conn.close(), client.closeWait())

trace "Cleaned up client", addrs = $client.remoteAddress,
conn

except CatchableError as exc:
let useExc {.used.} = exc
debug "Error cleaning up client", errMsg = exc.msg, conn
Expand Down

0 comments on commit f350479

Please sign in to comment.