diff options
Diffstat (limited to 'protocols/EmLanProto')
-rw-r--r-- | protocols/EmLanProto/src/lan.cpp | 9 | ||||
-rw-r--r-- | protocols/EmLanProto/src/lan.h | 4 |
2 files changed, 4 insertions, 9 deletions
diff --git a/protocols/EmLanProto/src/lan.cpp b/protocols/EmLanProto/src/lan.cpp index 739005574d..38dfb2a7fc 100644 --- a/protocols/EmLanProto/src/lan.cpp +++ b/protocols/EmLanProto/src/lan.cpp @@ -78,7 +78,6 @@ void CLan::StopListen() }
if (m_hAcceptTCPThread)
{
- mir_cslock lck(m_csAcceptTCPThread);
TerminateThread(m_hAcceptTCPThread, 0);
m_hAcceptTCPThread = NULL;
}
@@ -231,28 +230,26 @@ void CLan::AcceptTCP() sockaddr_in addrFrom;
int addrLen = sizeof(addrFrom);
in_socket = accept(m_filesoc, (sockaddr*)&addrFrom, &addrLen);
- mir_cslock lck(m_csAcceptTCPThread);
if (in_socket != INVALID_SOCKET)
{
TTCPConnect* tcp_conn = new TTCPConnect;
tcp_conn->m_addr = addrFrom.sin_addr.S_un.S_addr;
tcp_conn->m_lan = this;
tcp_conn->m_socket = in_socket;
- DWORD threadId;
- CreateThread(NULL, 0, OnInTCPConnectionProc, (LPVOID)tcp_conn, 0, &threadId);
+ mir_forkthread(OnInTCPConnectionProc, (void*)tcp_conn);
}
Sleep(100);
}
}
-DWORD WINAPI CLan::OnInTCPConnectionProc(LPVOID lpParameter)
+void __cdecl CLan::OnInTCPConnectionProc(void *lpParameter)
{
TTCPConnect* tcp_conn = (TTCPConnect*)lpParameter;
tcp_conn->m_lan->OnInTCPConnection(tcp_conn->m_addr, tcp_conn->m_socket);
shutdown(tcp_conn->m_socket, SD_BOTH);
closesocket(tcp_conn->m_socket);
delete tcp_conn;
- return 0;
+ return;
}
SOCKET CLan::CreateTCPConnection(u_long addr, LPVOID lpParameter)
diff --git a/protocols/EmLanProto/src/lan.h b/protocols/EmLanProto/src/lan.h index f84494cf05..6df1a07156 100644 --- a/protocols/EmLanProto/src/lan.h +++ b/protocols/EmLanProto/src/lan.h @@ -98,11 +98,9 @@ private: void AcceptTCP();
//! Accept TCP thread handle
HANDLE m_hAcceptTCPThread;
- //! Semaphore for killing accept thread
- mir_cs m_csAcceptTCPThread;
//! Called when new income TCP connection is created
- static DWORD WINAPI OnInTCPConnectionProc(LPVOID lpParameter);
+ static void __cdecl OnInTCPConnectionProc(void *lpParameter);
//! Called when new ougoing TCP connectio is created
static DWORD WINAPI OnOutTCPConnectionProc(LPVOID lpParameter);
|