From 95a469ad28e54fe05c3ae548725e557f91021d79 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 13 Dec 2015 12:53:29 -0300 Subject: added binary API to StreamPeer, fixes #2863 --- drivers/openssl/stream_peer_openssl.cpp | 7 +++++++ drivers/openssl/stream_peer_openssl.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'drivers/openssl') diff --git a/drivers/openssl/stream_peer_openssl.cpp b/drivers/openssl/stream_peer_openssl.cpp index ef07f11334..81795fdc60 100644 --- a/drivers/openssl/stream_peer_openssl.cpp +++ b/drivers/openssl/stream_peer_openssl.cpp @@ -479,6 +479,13 @@ Error StreamPeerOpenSSL::get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_ return OK; } +int StreamPeerOpenSSL::get_available_bytes() const { + + ERR_FAIL_COND_V(!connected,0); + + return SSL_pending(ssl); + +} StreamPeerOpenSSL::StreamPeerOpenSSL() { ctx=NULL; diff --git a/drivers/openssl/stream_peer_openssl.h b/drivers/openssl/stream_peer_openssl.h index a66b641dd4..64f5a1d7ac 100644 --- a/drivers/openssl/stream_peer_openssl.h +++ b/drivers/openssl/stream_peer_openssl.h @@ -71,6 +71,8 @@ public: virtual Error get_data(uint8_t* p_buffer, int p_bytes); virtual Error get_partial_data(uint8_t* p_buffer, int p_bytes,int &r_received); + virtual int get_available_bytes() const; + static void initialize_ssl(); static void finalize_ssl(); -- cgit v1.2.3