aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/tls_client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/tls_client.cpp')
-rw-r--r--doc/examples/tls_client.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/doc/examples/tls_client.cpp b/doc/examples/tls_client.cpp
index 82c8910f3..1ba69c150 100644
--- a/doc/examples/tls_client.cpp
+++ b/doc/examples/tls_client.cpp
@@ -105,18 +105,16 @@ void stream_socket_write(int sockfd, const byte buf[], size_t length)
bool got_alert = false;
-void process_data(const byte buf[], size_t buf_size, TLS::Alert alert)
+void alert_received(TLS::Alert alert, const byte buf[], size_t buf_size)
{
- if(alert.is_valid())
- {
- std::cout << "Alert: " << alert.type_string() << "\n";
- got_alert = true;
- }
+ std::cout << "Alert: " << alert.type_string() << "\n";
+ got_alert = true;
+ }
+void process_data(const byte buf[], size_t buf_size)
+ {
for(size_t i = 0; i != buf_size; ++i)
- {
std::cout << buf[i];
- }
}
std::string protocol_chooser(const std::vector<std::string>& protocols)
@@ -168,6 +166,7 @@ int main(int argc, char* argv[])
TLS::Client client(socket_write,
process_data,
+ alert_received,
handshake_complete,
session_manager,
creds,