Need to allow recreation of socket holder

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8017
This commit is contained in:
Jon Evans 2021-03-24 17:07:34 -04:00
parent b37b7d53b4
commit 7e8bd2e561
1 changed files with 2 additions and 3 deletions

View File

@ -301,7 +301,6 @@ private:
std::unique_ptr<ASYNC_SOCKET_HOLDER> socketHolder = nullptr;
std::once_flag socketHolderCreated;
/* Used by a client to sent (by a socket connection) a data to a server.
* - Open a Socket Client connection
@ -312,8 +311,8 @@ std::once_flag socketHolderCreated;
*/
bool SendCommand( int aService, const std::string& aMessage )
{
std::call_once( socketHolderCreated,
[]() { socketHolder.reset( new ASYNC_SOCKET_HOLDER() ); } );
if( !socketHolder )
socketHolder.reset( new ASYNC_SOCKET_HOLDER() );
return socketHolder->Send( aService, aMessage );
}