chadnickbok / librtcdcpp

A simple WebRTC DataChannels library
BSD 3-Clause "New" or "Revised" License
158 stars 41 forks source link

Implementing Close DataChannel #20

Closed mo3rfan closed 7 years ago

mo3rfan commented 7 years ago

I've noticed that Close() is a TODO at the moment. To implement this, is it sufficient to use usrsctp_deregister_address() as it's done here?

chadnickbok commented 7 years ago

It should be, but that would be well worth a double-check when implementing.

Thanks for the reminder, I'll try to take a look at implementing this, or you're more than welcome to submit a PR :)

mo3rfan commented 7 years ago

Ah okay, I'm looking at it too. I'm trying to ensure that the testclient program could terminate safely so I could then check for any memory leaks with valgrind.

chadnickbok commented 7 years ago

Perfect - one challenge I've had with Valgrind is that it gets super upset with OpenSSL. You can create ignore lists for a lot of the OpenSSL warnings that should help sort the signal from the noise.

mo3rfan commented 7 years ago

Yep! I've seen that. Crypto functions in OpenSSL use uninitialized memory on purpose for the entropy. I've used suppression files for this before.

Anyway, here's my attempt at solving this. I'm trying to reset the stream using SCTP_RESET_STREAMS, but I get EINVAL (errno 22) when I do this. Any Ideas?

mo3rfan commented 7 years ago

I think I got this working. Will send a PR soon once I do a bit of clean up :)

mo3rfan commented 7 years ago

PR: https://github.com/chadnickbok/librtcdcpp/pull/24