mirror of
https://github.com/qicosmos/rest_rpc.git
synced 2026-08-29 08:34:47 +08:00
fix for publish
This commit is contained in:
@@ -76,7 +76,8 @@
|
||||
<IncludePath>..\..\include;..\..\third\msgpack\include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\..\include;..\..\third\msgpack\include;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\..\include;..\..\third\msgpack\include;D:\boost_1_73_0;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>D:\boost_1_73_0\lib64-msvc-14.2;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\..\include;..\..\third\msgpack\include;$(IncludePath)</IncludePath>
|
||||
|
||||
@@ -161,17 +161,15 @@ namespace rest_rpc {
|
||||
|
||||
template<typename T>
|
||||
void publish(std::string key, std::string token, T data) {
|
||||
decltype(sub_map_.equal_range(key)) range;
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(sub_mtx_);
|
||||
if (sub_map_.empty())
|
||||
return;
|
||||
|
||||
range = sub_map_.equal_range(key + token);
|
||||
}
|
||||
|
||||
std::shared_ptr<std::string> shared_data = get_shared_data<T>(std::move(data));
|
||||
std::shared_ptr<std::string> shared_data = get_shared_data<T>(std::move(data));
|
||||
std::unique_lock<std::mutex> lock(sub_mtx_);
|
||||
auto range = sub_map_.equal_range(key + token);
|
||||
for (auto it = range.first; it != range.second; ++it) {
|
||||
auto conn = it->second.lock();
|
||||
if (conn == nullptr || conn->has_closed()) {
|
||||
|
||||
Reference in New Issue
Block a user