mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-17 12:42:51 +08:00
Fix crash during answer
This commit is contained in:
@@ -63,6 +63,8 @@ int IceTransport::InitIceTransport() {
|
|||||||
int IceTransport::InitIceTransport(std::string const &id) {
|
int IceTransport::InitIceTransport(std::string const &id) {
|
||||||
transport_id_ = id;
|
transport_id_ = id;
|
||||||
|
|
||||||
|
ice_agent_ = new IceAgent();
|
||||||
|
|
||||||
ice_agent_->CreateIceAgent(
|
ice_agent_->CreateIceAgent(
|
||||||
[](juice_agent_t *agent, juice_state_t state, void *user_ptr) {
|
[](juice_agent_t *agent, juice_state_t state, void *user_ptr) {
|
||||||
LOG_INFO("state_change: {}", ice_status[state]);
|
LOG_INFO("state_change: {}", ice_status[state]);
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
#include "ws_client.h"
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
#include <string>
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
class WsReceiver:public WsCore
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
WsReceiver(){}
|
|
||||||
~WsReceiver(){}
|
|
||||||
|
|
||||||
void OnReceiveMessage(const std::string &msg)
|
|
||||||
{
|
|
||||||
LOG_INFO("Receive msg: {}", msg);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
bool done = false;
|
|
||||||
std::string input;
|
|
||||||
WsReceiver ws_client;
|
|
||||||
|
|
||||||
LOG_INFO("connect ws://localhost:9002");
|
|
||||||
ws_client.Connect("ws://localhost:9002");
|
|
||||||
|
|
||||||
std::string status1 = ws_client.GetStatus();
|
|
||||||
|
|
||||||
while("Open" != status1)
|
|
||||||
{
|
|
||||||
status1 = ws_client.GetStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_INFO("Connect successfully!");
|
|
||||||
|
|
||||||
LOG_INFO("Send message [Hello]");
|
|
||||||
ws_client.Send("Hello");
|
|
||||||
|
|
||||||
LOG_INFO("Send ping");
|
|
||||||
ws_client.Ping();
|
|
||||||
|
|
||||||
LOG_INFO("Close conneciton");
|
|
||||||
int close_code = websocketpp::close::status::normal;
|
|
||||||
std::string reason = "User Close";
|
|
||||||
ws_client.Close(close_code, reason);
|
|
||||||
|
|
||||||
getchar();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
11
xmake.lua
11
xmake.lua
@@ -14,10 +14,10 @@ add_defines("ASIO_STANDALONE", "ASIO_HAS_STD_TYPE_TRAITS", "ASIO_HAS_STD_SHARED_
|
|||||||
"ASIO_HAS_STD_ADDRESSOF", "ASIO_HAS_STD_ATOMIC", "ASIO_HAS_STD_CHRONO", "ASIO_HAS_CSTDINT", "ASIO_HAS_STD_ARRAY",
|
"ASIO_HAS_STD_ADDRESSOF", "ASIO_HAS_STD_ATOMIC", "ASIO_HAS_STD_CHRONO", "ASIO_HAS_CSTDINT", "ASIO_HAS_STD_ARRAY",
|
||||||
"ASIO_HAS_STD_SYSTEM_ERROR")
|
"ASIO_HAS_STD_SYSTEM_ERROR")
|
||||||
|
|
||||||
if is_plat("windows") then
|
if is_os("windows") then
|
||||||
add_defines("_WEBSOCKETPP_CPP11_INTERNAL_")
|
add_defines("_WEBSOCKETPP_CPP11_INTERNAL_")
|
||||||
add_links("ws2_32", "Bcrypt")
|
add_links("ws2_32", "Bcrypt")
|
||||||
elseif is_plat("linux") then
|
elseif is_os("linux") then
|
||||||
add_links("pthread")
|
add_links("pthread")
|
||||||
set_config("cxxflags", "-fPIC")
|
set_config("cxxflags", "-fPIC")
|
||||||
end
|
end
|
||||||
@@ -73,13 +73,6 @@ target("signal_server")
|
|||||||
add_packages("asio", "nlohmann_json", "spdlog")
|
add_packages("asio", "nlohmann_json", "spdlog")
|
||||||
add_includedirs("thirdparty/websocketpp/include")
|
add_includedirs("thirdparty/websocketpp/include")
|
||||||
|
|
||||||
-- target("signal_client")
|
|
||||||
-- set_kind("binary")
|
|
||||||
-- add_deps("ws")
|
|
||||||
-- add_files("tests/signal_client/signal_client.cpp")
|
|
||||||
-- add_packages("asio")
|
|
||||||
-- add_includedirs("src/ws", "thirdparty/websocketpp/include")
|
|
||||||
|
|
||||||
target("Offer")
|
target("Offer")
|
||||||
set_kind("binary")
|
set_kind("binary")
|
||||||
add_deps("projectx")
|
add_deps("projectx")
|
||||||
|
|||||||
Reference in New Issue
Block a user