summaryrefslogtreecommitdiffstats
path: root/src/OSSupport/TCPLinkImpl.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-25 23:12:41 +0100
committerMattes D <github@xoft.cz>2015-01-27 14:53:37 +0100
commit9a2200f8bb55cbce7a82f1d3d683371fd563e2b2 (patch)
treebcc6ca3308464171646a616f5ed921a16c09b65a /src/OSSupport/TCPLinkImpl.cpp
parentServerHandleImpl: Removed needless diagnostic output. (diff)
downloadcuberite-9a2200f8bb55cbce7a82f1d3d683371fd563e2b2.tar
cuberite-9a2200f8bb55cbce7a82f1d3d683371fd563e2b2.tar.gz
cuberite-9a2200f8bb55cbce7a82f1d3d683371fd563e2b2.tar.bz2
cuberite-9a2200f8bb55cbce7a82f1d3d683371fd563e2b2.tar.lz
cuberite-9a2200f8bb55cbce7a82f1d3d683371fd563e2b2.tar.xz
cuberite-9a2200f8bb55cbce7a82f1d3d683371fd563e2b2.tar.zst
cuberite-9a2200f8bb55cbce7a82f1d3d683371fd563e2b2.zip
Diffstat (limited to 'src/OSSupport/TCPLinkImpl.cpp')
-rw-r--r--src/OSSupport/TCPLinkImpl.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/OSSupport/TCPLinkImpl.cpp b/src/OSSupport/TCPLinkImpl.cpp
index b4cefa60c..f97db7582 100644
--- a/src/OSSupport/TCPLinkImpl.cpp
+++ b/src/OSSupport/TCPLinkImpl.cpp
@@ -17,8 +17,9 @@
cTCPLinkImpl::cTCPLinkImpl(cTCPLink::cCallbacksPtr a_LinkCallbacks):
super(a_LinkCallbacks),
- m_BufferEvent(bufferevent_socket_new(cNetworkSingleton::Get().GetEventBase(), -1, BEV_OPT_CLOSE_ON_FREE))
+ m_BufferEvent(bufferevent_socket_new(cNetworkSingleton::Get().GetEventBase(), -1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE))
{
+ LOGD("Created new cTCPLinkImpl at %p with BufferEvent at %p", this, m_BufferEvent);
}
@@ -27,9 +28,11 @@ cTCPLinkImpl::cTCPLinkImpl(cTCPLink::cCallbacksPtr a_LinkCallbacks):
cTCPLinkImpl::cTCPLinkImpl(evutil_socket_t a_Socket, cTCPLink::cCallbacksPtr a_LinkCallbacks, cServerHandleImplPtr a_Server, const sockaddr * a_Address, socklen_t a_AddrLen):
super(a_LinkCallbacks),
- m_BufferEvent(bufferevent_socket_new(cNetworkSingleton::Get().GetEventBase(), a_Socket, BEV_OPT_CLOSE_ON_FREE)),
+ m_BufferEvent(bufferevent_socket_new(cNetworkSingleton::Get().GetEventBase(), a_Socket, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE)),
m_Server(a_Server)
{
+ LOGD("Created new cTCPLinkImpl at %p with BufferEvent at %p", this, m_BufferEvent);
+
// Update the endpoint addresses:
UpdateLocalAddress();
UpdateAddress(a_Address, a_AddrLen, m_RemoteIP, m_RemotePort);
@@ -41,6 +44,7 @@ cTCPLinkImpl::cTCPLinkImpl(evutil_socket_t a_Socket, cTCPLink::cCallbacksPtr a_L
cTCPLinkImpl::~cTCPLinkImpl()
{
+ LOGD("Deleting cTCPLinkImpl at %p with BufferEvent at %p", this, m_BufferEvent);
bufferevent_free(m_BufferEvent);
}
@@ -179,6 +183,8 @@ void cTCPLinkImpl::ReadCallback(bufferevent * a_BufferEvent, void * a_Self)
void cTCPLinkImpl::EventCallback(bufferevent * a_BufferEvent, short a_What, void * a_Self)
{
+ LOGD("cTCPLink event callback for link %p, BEV %p; what = 0x%02x", a_Self, a_BufferEvent, a_What);
+
ASSERT(a_Self != nullptr);
cTCPLinkImplPtr Self = static_cast<cTCPLinkImpl *>(a_Self)->m_Self;