Make ownership of SocketMultiplexer explicit
This commit is contained in:
parent
e31ebc1b22
commit
8dd6bc2c55
|
@ -200,7 +200,7 @@ App::initApp(int argc, const char** argv)
|
|||
void
|
||||
App::initIpcClient()
|
||||
{
|
||||
m_ipcClient = new IpcClient(m_events, m_socketMultiplexer);
|
||||
m_ipcClient = new IpcClient(m_events, m_socketMultiplexer.get());
|
||||
m_ipcClient->connect();
|
||||
|
||||
m_events->adoptHandler(
|
||||
|
|
|
@ -23,7 +23,9 @@
|
|||
#include "base/String.h"
|
||||
#include "base/Log.h"
|
||||
#include "base/EventQueue.h"
|
||||
#include "net/SocketMultiplexer.h"
|
||||
#include "common/common.h"
|
||||
#include <memory>
|
||||
|
||||
#if SYSAPI_WIN32
|
||||
#include "barrier/win32/AppUtilWindows.h"
|
||||
|
@ -95,8 +97,8 @@ public:
|
|||
|
||||
virtual IEventQueue* getEvents() const { return m_events; }
|
||||
|
||||
void setSocketMultiplexer(SocketMultiplexer* sm) { m_socketMultiplexer = sm; }
|
||||
SocketMultiplexer* getSocketMultiplexer() const { return m_socketMultiplexer; }
|
||||
void setSocketMultiplexer(std::unique_ptr<SocketMultiplexer>&& sm) { m_socketMultiplexer = std::move(sm); }
|
||||
SocketMultiplexer* getSocketMultiplexer() const { return m_socketMultiplexer.get(); }
|
||||
|
||||
void setEvents(EventQueue& events) { m_events = &events; }
|
||||
|
||||
|
@ -119,7 +121,7 @@ private:
|
|||
CreateTaskBarReceiverFunc m_createTaskBarReceiver;
|
||||
ARCH_APP_UTIL m_appUtil;
|
||||
IpcClient* m_ipcClient;
|
||||
SocketMultiplexer* m_socketMultiplexer;
|
||||
std::unique_ptr<SocketMultiplexer> m_socketMultiplexer;
|
||||
};
|
||||
|
||||
class MinimalApp : public App {
|
||||
|
|
|
@ -443,8 +443,7 @@ ClientApp::mainLoop()
|
|||
{
|
||||
// create socket multiplexer. this must happen after daemonization
|
||||
// on unix because threads evaporate across a fork().
|
||||
SocketMultiplexer multiplexer;
|
||||
setSocketMultiplexer(&multiplexer);
|
||||
setSocketMultiplexer(std::make_unique<SocketMultiplexer>());
|
||||
|
||||
// start client, etc
|
||||
appUtil().startNode();
|
||||
|
|
|
@ -713,8 +713,7 @@ ServerApp::mainLoop()
|
|||
{
|
||||
// create socket multiplexer. this must happen after daemonization
|
||||
// on unix because threads evaporate across a fork().
|
||||
SocketMultiplexer multiplexer;
|
||||
setSocketMultiplexer(&multiplexer);
|
||||
setSocketMultiplexer(std::make_unique<SocketMultiplexer>());
|
||||
|
||||
// if configuration has no screens then add this system
|
||||
// as the default
|
||||
|
|
Loading…
Reference in New Issue