aboutsummaryrefslogtreecommitdiff
path: root/src/server/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/ipc')
-rw-r--r--src/server/ipc/CMakeLists.txt7
-rw-r--r--src/server/ipc/Commands.cpp22
-rw-r--r--src/server/ipc/Commands.h55
-rw-r--r--src/server/ipc/ZMQTask.cpp3
-rw-r--r--src/server/ipc/ZMQTask.h2
-rw-r--r--src/server/ipc/ZmqContext.cpp9
-rw-r--r--src/server/ipc/ZmqContext.h2
-rw-r--r--src/server/ipc/ZmqListener.cpp2
-rw-r--r--src/server/ipc/ZmqListener.h2
-rw-r--r--src/server/ipc/ZmqMux.cpp2
-rw-r--r--src/server/ipc/ZmqMux.h2
-rw-r--r--src/server/ipc/ZmqWorker.cpp2
-rw-r--r--src/server/ipc/ZmqWorker.h2
13 files changed, 58 insertions, 54 deletions
diff --git a/src/server/ipc/CMakeLists.txt b/src/server/ipc/CMakeLists.txt
index 95e5e2fc0da..ca29ebe61b3 100644
--- a/src/server/ipc/CMakeLists.txt
+++ b/src/server/ipc/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+# Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -8,6 +8,8 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+find_package(ZMQ REQUIRED)
+
file(GLOB_RECURSE sources_ipc *.cpp *.h)
set(ipc_SRCS
@@ -17,7 +19,8 @@ set(ipc_SRCS
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/dep/zmqpp
- ${CMAKE_SOURCE_DIR}/src/server/shared/
+ ${CMAKE_SOURCE_DIR}/src/common
+ ${CMAKE_SOURCE_DIR}/src/server/shared
${ZMQ_INCLUDE_DIR}
)
diff --git a/src/server/ipc/Commands.cpp b/src/server/ipc/Commands.cpp
index e08943030f7..3eb78cbc14a 100644
--- a/src/server/ipc/Commands.cpp
+++ b/src/server/ipc/Commands.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -18,7 +18,7 @@
#include "Commands.h"
#include <zmqpp/message.hpp>
-zmqpp::message& operator>>(zmqpp::message& msg, IPCHeader& header)
+zmqpp::message& operator>>(zmqpp::message& msg, IPC::Header& header)
{
msg >> header.Channel;
msg >> header.Command;
@@ -28,19 +28,19 @@ zmqpp::message& operator>>(zmqpp::message& msg, IPCHeader& header)
zmqpp::message& operator>>(zmqpp::message& msg, Battlenet::RealmHandle& realm)
{
msg >> realm.Region;
- msg >> realm.Battlegroup;
- msg >> realm.Index;
+ msg >> realm.Site;
+ msg >> realm.Realm;
return msg;
}
-zmqpp::message& operator>>(zmqpp::message& msg, Battlenet::Header& header)
+zmqpp::message& operator>>(zmqpp::message& msg, IPC::BattlenetComm::Header& header)
{
msg >> header.Ipc;
msg >> header.Realm;
return msg;
}
-zmqpp::message& operator>>(zmqpp::message& msg, Battlenet::ToonHandle& toonHandle)
+zmqpp::message& operator>>(zmqpp::message& msg, IPC::BattlenetComm::ToonHandle& toonHandle)
{
msg >> toonHandle.AccountId;
msg >> toonHandle.GameAccountId;
@@ -49,7 +49,7 @@ zmqpp::message& operator>>(zmqpp::message& msg, Battlenet::ToonHandle& toonHandl
return msg;
}
-zmqpp::message& operator<<(zmqpp::message& msg, IPCHeader const& header)
+zmqpp::message& operator<<(zmqpp::message& msg, IPC::Header const& header)
{
msg << header.Channel;
msg << header.Command;
@@ -59,19 +59,19 @@ zmqpp::message& operator<<(zmqpp::message& msg, IPCHeader const& header)
zmqpp::message& operator<<(zmqpp::message& msg, Battlenet::RealmHandle const& realm)
{
msg << realm.Region;
- msg << realm.Battlegroup;
- msg << realm.Index;
+ msg << realm.Site;
+ msg << realm.Realm;
return msg;
}
-zmqpp::message& operator<<(zmqpp::message& msg, Battlenet::Header const& header)
+zmqpp::message& operator<<(zmqpp::message& msg, IPC::BattlenetComm::Header const& header)
{
msg << header.Ipc;
msg << header.Realm;
return msg;
}
-zmqpp::message& operator<<(zmqpp::message& msg, Battlenet::ToonHandle const& toonHandle)
+zmqpp::message& operator<<(zmqpp::message& msg, IPC::BattlenetComm::ToonHandle const& toonHandle)
{
msg << toonHandle.AccountId;
msg << toonHandle.GameAccountId;
diff --git a/src/server/ipc/Commands.h b/src/server/ipc/Commands.h
index b594090b0f8..618e8ca0509 100644
--- a/src/server/ipc/Commands.h
+++ b/src/server/ipc/Commands.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -19,6 +19,7 @@
#define _COMMANDS_H
#include "Define.h"
+#include "Realm/Realm.h"
#include <string>
enum Channels
@@ -35,34 +36,30 @@ enum BnetCommands
IPC_BNET_MAX_COMMAND
};
-struct IPCHeader
+namespace IPC
{
- uint8 Channel;
- uint8 Command;
-};
-
-namespace Battlenet
-{
- struct RealmHandle
- {
- uint8 Region;
- uint8 Battlegroup;
- uint32 Index;
- };
-
struct Header
{
- IPCHeader Ipc;
- RealmHandle Realm;
+ uint8 Channel;
+ uint8 Command;
};
- struct ToonHandle
+ namespace BattlenetComm
{
- uint32 AccountId;
- uint32 GameAccountId;
- uint64 Guid;
- std::string Name;
- };
+ struct Header
+ {
+ IPC::Header Ipc;
+ Battlenet::RealmHandle Realm;
+ };
+
+ struct ToonHandle
+ {
+ uint32 AccountId;
+ uint32 GameAccountId;
+ uint64 Guid;
+ std::string Name;
+ };
+ }
}
namespace zmqpp
@@ -70,14 +67,14 @@ namespace zmqpp
class message;
}
-zmqpp::message& operator>>(zmqpp::message& msg, IPCHeader& header);
+zmqpp::message& operator>>(zmqpp::message& msg, IPC::Header& header);
zmqpp::message& operator>>(zmqpp::message& msg, Battlenet::RealmHandle& realm);
-zmqpp::message& operator>>(zmqpp::message& msg, Battlenet::Header& header);
-zmqpp::message& operator>>(zmqpp::message& msg, Battlenet::ToonHandle& toonHandle);
+zmqpp::message& operator>>(zmqpp::message& msg, IPC::BattlenetComm::Header& header);
+zmqpp::message& operator>>(zmqpp::message& msg, IPC::BattlenetComm::ToonHandle& toonHandle);
-zmqpp::message& operator<<(zmqpp::message& msg, IPCHeader const& header);
+zmqpp::message& operator<<(zmqpp::message& msg, IPC::Header const& header);
zmqpp::message& operator<<(zmqpp::message& msg, Battlenet::RealmHandle const& realm);
-zmqpp::message& operator<<(zmqpp::message& msg, Battlenet::Header const& header);
-zmqpp::message& operator<<(zmqpp::message& msg, Battlenet::ToonHandle const& toonHandle);
+zmqpp::message& operator<<(zmqpp::message& msg, IPC::BattlenetComm::Header const& header);
+zmqpp::message& operator<<(zmqpp::message& msg, IPC::BattlenetComm::ToonHandle const& toonHandle);
#endif // _COMMANDS_H
diff --git a/src/server/ipc/ZMQTask.cpp b/src/server/ipc/ZMQTask.cpp
index fe09775505f..6d359d9b10a 100644
--- a/src/server/ipc/ZMQTask.cpp
+++ b/src/server/ipc/ZMQTask.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -44,6 +44,7 @@ void ZMQTask::Start()
void ZMQTask::End()
{
_thread->join();
+ _poller->remove(*_inproc);
_inproc->close();
HandleClose();
}
diff --git a/src/server/ipc/ZMQTask.h b/src/server/ipc/ZMQTask.h
index 8dc6563fecb..85773adbfd1 100644
--- a/src/server/ipc/ZMQTask.h
+++ b/src/server/ipc/ZMQTask.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/server/ipc/ZmqContext.cpp b/src/server/ipc/ZmqContext.cpp
index dfe2ec2b749..bc062de8e88 100644
--- a/src/server/ipc/ZmqContext.cpp
+++ b/src/server/ipc/ZmqContext.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -23,13 +23,14 @@ ZmqContext::ZmqContext() : _inproc(nullptr)
ZmqContext::~ZmqContext()
{
- delete _inproc;
}
zmqpp::socket* ZmqContext::CreateNewSocket(zmqpp::socket_type type)
{
std::unique_lock<std::mutex> lock(_mutex);
- return new zmqpp::socket(_context, type);
+ zmqpp::socket* socket = new zmqpp::socket(_context, type);
+ socket->set(zmqpp::socket_option::linger, 0);
+ return socket;
}
void ZmqContext::Initialize()
@@ -49,4 +50,6 @@ zmqpp::socket* ZmqContext::CreateInprocSubscriber()
void ZmqContext::Close()
{
_inproc->send("internalmq.kill");
+ delete _inproc;
+ _inproc = nullptr;
}
diff --git a/src/server/ipc/ZmqContext.h b/src/server/ipc/ZmqContext.h
index d0124a62ec3..99f49a8c597 100644
--- a/src/server/ipc/ZmqContext.h
+++ b/src/server/ipc/ZmqContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/server/ipc/ZmqListener.cpp b/src/server/ipc/ZmqListener.cpp
index 515cea090e2..a7cf78f8a92 100644
--- a/src/server/ipc/ZmqListener.cpp
+++ b/src/server/ipc/ZmqListener.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/server/ipc/ZmqListener.h b/src/server/ipc/ZmqListener.h
index e536fee88e7..07798b81886 100644
--- a/src/server/ipc/ZmqListener.h
+++ b/src/server/ipc/ZmqListener.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/server/ipc/ZmqMux.cpp b/src/server/ipc/ZmqMux.cpp
index 0f7a8ad8b1b..d6dcd0f73f6 100644
--- a/src/server/ipc/ZmqMux.cpp
+++ b/src/server/ipc/ZmqMux.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/server/ipc/ZmqMux.h b/src/server/ipc/ZmqMux.h
index e19568e82c3..1009382f101 100644
--- a/src/server/ipc/ZmqMux.h
+++ b/src/server/ipc/ZmqMux.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/server/ipc/ZmqWorker.cpp b/src/server/ipc/ZmqWorker.cpp
index 5d2d161d1ec..617730ad013 100644
--- a/src/server/ipc/ZmqWorker.cpp
+++ b/src/server/ipc/ZmqWorker.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/server/ipc/ZmqWorker.h b/src/server/ipc/ZmqWorker.h
index 2639d178764..21d2d95ac18 100644
--- a/src/server/ipc/ZmqWorker.h
+++ b/src/server/ipc/ZmqWorker.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the