mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-20 19:14:39 +08:00
[fix] avoid X11 macro conflict in announcement requests
This commit is contained in:
@@ -2315,7 +2315,7 @@ void GuiApplication::SyncAnnouncements() {
|
|||||||
announcements_.Configure(params_.signal_server_ip,
|
announcements_.Configure(params_.signal_server_ip,
|
||||||
params_.signal_server_port, client_id_);
|
params_.signal_server_port, client_id_);
|
||||||
}
|
}
|
||||||
const auto request = announcements_.NextRequest();
|
const auto request = announcements_.TakePendingRequest();
|
||||||
if (!request.is_null()) {
|
if (!request.is_null()) {
|
||||||
const auto payload = request.dump();
|
const auto payload = request.dump();
|
||||||
if (!peer_ || SendSignalMessage(peer_, payload.data(), payload.size()) != 0)
|
if (!peer_ || SendSignalMessage(peer_, payload.data(), payload.size()) != 0)
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ void AnnouncementInbox::Fail() {
|
|||||||
state_.failed = true;
|
state_.failed = true;
|
||||||
++state_.version;
|
++state_.version;
|
||||||
}
|
}
|
||||||
nlohmann::json AnnouncementInbox::NextRequest(
|
nlohmann::json AnnouncementInbox::TakePendingRequest(
|
||||||
std::chrono::steady_clock::time_point now) {
|
std::chrono::steady_clock::time_point now) {
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
if (!connected_ || scope_.empty()) return nullptr;
|
if (!connected_ || scope_.empty()) return nullptr;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class AnnouncementInbox {
|
|||||||
void SetConnected(bool connected);
|
void SetConnected(bool connected);
|
||||||
void Refresh(int offset = -1);
|
void Refresh(int offset = -1);
|
||||||
bool Read(int64_t id, int64_t revision);
|
bool Read(int64_t id, int64_t revision);
|
||||||
nlohmann::json NextRequest(std::chrono::steady_clock::time_point now =
|
nlohmann::json TakePendingRequest(std::chrono::steady_clock::time_point now =
|
||||||
std::chrono::steady_clock::now());
|
std::chrono::steady_clock::now());
|
||||||
void Failed(const std::string& request_id);
|
void Failed(const std::string& request_id);
|
||||||
void Receive(const nlohmann::json& message);
|
void Receive(const nlohmann::json& message);
|
||||||
@@ -63,4 +63,4 @@ class AnnouncementInbox {
|
|||||||
};
|
};
|
||||||
} // namespace crossdesk
|
} // namespace crossdesk
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user