libcoro icon indicating copy to clipboard operation
libcoro copied to clipboard

Make coro::net::ssl_context a shared_ptr when used with schedulers and clients

Open jbaldwin opened this issue 4 years ago • 2 comments

Right now in the example test_tcp_server.cpp:85 it passes the ssl contexts into the schedulers and clients by reference, this should ideally be by shared_ptr copy since the lifetimes are now bound.

jbaldwin avatar Jul 25 '21 20:07 jbaldwin

I'm not sure this is the right thing to do now, perhaps each client or server should make their own context and just own it? I think my original idea was to allow the user to pass it between clients or servers to re-use them, but I think this makes the lifetimes ambiguous.

jbaldwin avatar Jul 26 '21 15:07 jbaldwin

I agree. But at the very least it should accept a reference instead of a pointer - using raw pointers in C++ is known as bad practice.

niansa avatar Jul 27 '21 17:07 niansa

I'm planning on dropping ssl support since it doesn't really seem necessary, and I don't have the time to support it, so going to close this one out.

jbaldwin avatar Feb 23 '23 19:02 jbaldwin