aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-08-06 12:49:32 +0000
committerlloyd <[email protected]>2012-08-06 12:49:32 +0000
commitc41ec2821df51fdefcb065a0870921c0027b8982 (patch)
tree83c2b862a2cd0c7b6c34a13d0a57e57f4177b494 /src
parent55285c8e3ffcd78d4f9bc543648eb215205b3ae7 (diff)
A heartbeat request send by the counterparty during a handshake would
be passed to the application callback as a heartbeat response.
Diffstat (limited to 'src')
-rw-r--r--src/tls/tls_channel.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/tls/tls_channel.cpp b/src/tls/tls_channel.cpp
index 253110c81..a09dc5afc 100644
--- a/src/tls/tls_channel.cpp
+++ b/src/tls/tls_channel.cpp
@@ -83,16 +83,19 @@ size_t Channel::received_data(const byte buf[], size_t buf_size)
const std::vector<byte>& payload = heartbeat.payload();
- if(heartbeat.is_request() && !m_state)
+ if(heartbeat.is_request())
{
- Heartbeat_Message response(Heartbeat_Message::RESPONSE,
- &payload[0], payload.size());
+ if(!m_state) // no heartbeats during handshake
+ {
+ Heartbeat_Message response(Heartbeat_Message::RESPONSE,
+ &payload[0], payload.size());
- m_writer.send(HEARTBEAT, response.contents());
+ m_writer.send(HEARTBEAT, response.contents());
+ }
}
else
{
- // pass up to the application
+ // a response, pass up to the application
m_proc_fn(&payload[0], payload.size(), Alert(Alert::HEARTBEAT_PAYLOAD));
}
}