iproto: always reload URIs on reconfiguration
Even if the new value of box.cfg.listen is the same as the old one, we still need to recreate evio service entries' IO stream contexts from the URIs on reconfiguration, because a URI parameter may store a path to a file (for example, an SSL certificate), which could change. Note that we have to rework the way how IO stream contexts are handled on evio_service_attach. Before this patch, we copied struct iostream_ctx directly from the source service to the attached service. It was fine, because (a) we didn't destroy iostream_ctx on detach (we only cleared it) and (b) we detached IPROTO threads' services from tx_binary before stopping tx_binary. Now, to reload URIs, we first call the new function evio_service_reload_uris on tx_binary to recreate iostream_ctx, and only then reattach IPROTO threads' services, which opens a window for an IPROTO thread's service to access a destroyed iostream_ctx context while accepting a new connection. To avoid that, we now copy iostream_ctx to attached services with the new function iostream_ctx_copy. This function copies the underlying SSL_CTX with a stub function ssl_iostream_ctx_dup, which will be implemented in the EE repository using SSL_CTX_up_ref (i.e. no actual copying will happen - we'll just increment the internal SSL_CTX reference counter). Needed for tarantool/tarantool-ee#432 NO_DOC=ee NO_TEST=ee NO_CHANGELOG=ee
Showing
- src/box/iproto.cc 26 additions, 2 deletionssrc/box/iproto.cc
- src/lib/core/evio.c 24 additions, 4 deletionssrc/lib/core/evio.c
- src/lib/core/evio.h 13 additions, 0 deletionssrc/lib/core/evio.h
- src/lib/core/iostream.c 8 additions, 0 deletionssrc/lib/core/iostream.c
- src/lib/core/iostream.h 6 additions, 0 deletionssrc/lib/core/iostream.h
- src/lib/core/ssl.h 9 additions, 0 deletionssrc/lib/core/ssl.h
Loading
Please register or sign in to comment