Commit 01b2f1aa authored by Kimapr's avatar Kimapr Committed by GitHub

Fix TCP behavior test with ephemeral port (#68)

by reading the local address from the last connection and reusing it
in the next one, to avoid OS allocating a new port each time
parent 2049da33
...@@ -304,7 +304,7 @@ void TcpClientLoop(StunClientLogicConfig& config, ClientSocketConfig& socketconf ...@@ -304,7 +304,7 @@ void TcpClientLoop(StunClientLogicConfig& config, ClientSocketConfig& socketconf
int sock; int sock;
CRefCountedBuffer spMsg(new CBuffer(1500)); CRefCountedBuffer spMsg(new CBuffer(1500));
CRefCountedBuffer spMsgReader(new CBuffer(1500)); CRefCountedBuffer spMsgReader(new CBuffer(1500));
CSocketAddress addrDest, addrLocal; CSocketAddress addrDest, addrLocal = socketconfig.addrLocal;
HRESULT hrRet, hrResult; HRESULT hrRet, hrResult;
int ret; int ret;
size_t bytes_sent, bytes_recv; size_t bytes_sent, bytes_recv;
...@@ -327,7 +327,7 @@ void TcpClientLoop(StunClientLogicConfig& config, ClientSocketConfig& socketconf ...@@ -327,7 +327,7 @@ void TcpClientLoop(StunClientLogicConfig& config, ClientSocketConfig& socketconf
{ {
stunsocket.Close(); stunsocket.Close();
hr = stunsocket.TCPInit(socketconfig.addrLocal, RolePP, true); hr = stunsocket.TCPInit(addrLocal, RolePP, true);
if (FAILED(hr)) if (FAILED(hr))
{ {
Logging::LogMsg(LL_ALWAYS, "Unable to create local socket for TCP connection (hr == %x)", hr); Logging::LogMsg(LL_ALWAYS, "Unable to create local socket for TCP connection (hr == %x)", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment