summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/ipc/raw_tcp_connection.cpp
blob: 946aefcafa1bf758c5f795e21830bc5931305305 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// license:BSD-3-Clause
// copyright-holders:Inaki Baz Castillo,Miodrag Milanovic

#include "raw_tcp_connection.h"

/* Instance methods. */

raw_tcp_connection::raw_tcp_connection(listener* listener, size_t bufferSize) :
	tcp_connection(bufferSize),
	m_listener(listener)
{
}

raw_tcp_connection::~raw_tcp_connection()
{
}

void raw_tcp_connection::user_on_tcp_connection_read()
{
	// We may receive multiple packets in the same TCP chunk. If one of them is
	// a DTLS Close Alert this would be closed (close() called) so we cannot call
	// our listeners anymore.
	if (is_closing())
		return;

	m_listener->on_data_recv(this, m_buffer, m_buffer_data_len);

	m_buffer_data_len = 0;
}