~nytpu/tlsada

1f1eb95adee1ce39ffdb62cd5ea9f8dd6a19d61d — nytpu 1 year, 11 months ago b17888f
TLS.Contexts.Close: Fix bug that causes internal libtls error when reusing contexts
2 files changed, 7 insertions(+), 3 deletions(-)

M src/tls-contexts.adb
M src/tls-contexts.ads
M src/tls-contexts.adb => src/tls-contexts.adb +2 -0
@@ 309,6 309,8 @@ package body TLS.Contexts is
	procedure Close (Ctx : in out Context) is
	begin
		Close(Ctx.Context);
		Bs.tls_reset(Ctx.Context.Context);
		Ctx.Context.Configured := False;
	end Close;



M src/tls-contexts.ads => src/tls-contexts.ads +5 -3
@@ 140,12 140,14 @@ package TLS.Contexts is
		with Pre => Ctx.Is_Connected;

	-- Close an open TLS connection, or have no effect if there is no active
	-- connection.  If a connection was estabilished using an existing socket
	-- then the socket itself will NOT be closed.
	-- connection.  The Context will be suitable for reconfiguration and then
	-- reconnection.  If a connection was estabilished using an existing socket
	-- then the socket itself will NOT be closed.  Due to libtls' internals,
	-- the configuration of the context will be reset.
	-- Note that even if the peer has closed their end of the connection, you
	-- MUST close your end as well.
	procedure Close (Ctx : in out Context)
		with Post => not Ctx.Is_Connected;
		with Post => Ctx.Is_Initialized and then (not Ctx.Is_Configued and not Ctx.Is_Connected);

	-- Return a record containing information about the current TLS connection.
	function Get_Connection_Info (Ctx : Context) return Connection_Info