Move UPnP port forwarding to a thread.
Fix some typos.
Do not return the result, as we would need to allocate it, but we never use it.
Description
Description
Details
Details
- Committed
• leper Dec 17 2013, 6:03 PM - Parents
- rP14371: Try to actually do the threading my previous commit said it did.
- Branches
- Unknown
- Tags
Event Timeline
/ps/trunk/source/network/NetServer.cpp | ||
---|---|---|
162 | No pthread_detach()? |
Comment Actions
From the IRClogs I understand that the purpose was very narrow, but someone should at some point have considered whether letting the thread just run around for a minute or something is the right thing to do after the NetServer was destroyed and possibly N more new ones created meanwhile.
Other than that it must call pthread_detach() or pthread_join()` to free the thread resource.
Valgrind shows this:
==2498== 480 bytes in 1 blocks are possibly lost in loss record 2,766 of 3,209 ==2498== at 0x483AB65: calloc (vg_replace_malloc.c:752) ==2498== by 0x4012AC1: allocate_dtv (in /usr/lib/ld-2.29.so) ==2498== by 0x4013431: _dl_allocate_tls (in /usr/lib/ld-2.29.so) ==2498== by 0x66781AD: pthread_create@@GLIBC_2.2.5 (in /usr/lib/libpthread-2.29.so) ==2498== by 0x190EA0: CNetServerWorker::SetupConnection(unsigned short) (NetServer.cpp:210) ==2498== by 0x19A84C: CNetServer::SetupConnection(unsigned short) (NetServer.cpp:1593) ==2498== by 0x5F1561: JSI_Network::StartNetworkHost(ScriptInterface::CxPrivate*, CStrW const&, unsigned short, CStr8 const&) (JSInterface_Network.cpp:62) ==2498== by 0x5F2BE0: call<void (ScriptInterface::CxPrivate *, const CStrW &, unsigned short, const CStr8 &), CStrW, unsigned short, CStr8> (NativeWrapperDefns.h:86) ==2498== by 0x5F2BE0: bool ScriptInterface::call<void, CStrW, unsigned short, CStr8, &JSI_Network::StartNetworkHost>(JSContext*, unsigned int, JS::Value*) (NativeWrapperDefns.h:125) ==2498== by 0x50969E7: CallJSNative (jscntxtinlines.h:235) ==2498== by 0x50969E7: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) (Interpreter.cpp:444) ==2498== by 0x508C4DB: Interpret(JSContext*, js::RunState&) (Interpreter.cpp:2766) ==2498== by 0x5096656: js::RunScript(JSContext*, js::RunState&) (Interpreter.cpp:391) ==2498== by 0x509691C: js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) (Interpreter.cpp:462)
If one adds one of the two pthread commands, then this valgrind message disappears.
So the missing detach / join is only the error that was revealed by using the new syntax in rP22666.