aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-16 15:23:24 -0500
committerJack Lloyd <[email protected]>2016-11-16 15:23:24 -0500
commit674b7c5a16f449f6024b99a1b208feaa933ca8a5 (patch)
treeab17c8b7a4a4250982c000e5dd31fc755b6d7826
parent95764150587d037ed895bdef71d575eeebda9ce5 (diff)
Add new TLS callback for when session is activated
The current session established cb happens before the session is activated, so it is not possible to send application data in response to the connection being made.
-rw-r--r--src/lib/tls/tls_callbacks.h6
-rw-r--r--src/lib/tls/tls_channel.cpp2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/tls/tls_callbacks.h b/src/lib/tls/tls_callbacks.h
index 4a14055f9..f81071a05 100644
--- a/src/lib/tls/tls_callbacks.h
+++ b/src/lib/tls/tls_callbacks.h
@@ -75,6 +75,12 @@ class BOTAN_DLL Callbacks
virtual bool tls_session_established(const Session& session) = 0;
/**
+ * Optional callback: session activated
+ * Called when a session is active and can be written to
+ */
+ virtual void tls_session_activated() {}
+
+ /**
* Optional callback: inspect handshake message
* Throw an exception to abort the handshake.
* Default simply ignores the message.
diff --git a/src/lib/tls/tls_channel.cpp b/src/lib/tls/tls_channel.cpp
index 574be8a46..95b151ad2 100644
--- a/src/lib/tls/tls_channel.cpp
+++ b/src/lib/tls/tls_channel.cpp
@@ -284,6 +284,8 @@ void Channel::activate_session()
map_remove_if(not_current_epoch, m_write_cipher_states);
map_remove_if(not_current_epoch, m_read_cipher_states);
}
+
+ callbacks().tls_session_activated();
}
size_t Channel::received_data(const std::vector<byte>& buf)