MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / ConnectThread

Method ConnectThread

plugins/twitch/chat-connection.cpp:419–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419void TwitchChatConnection::ConnectThread()
420{
421 while (!_stop) {
422 _state = State::CONNECTING;
423 _client.reset();
424 websocketpp::lib::error_code ec;
425 websocketpp::client<websocketpp::config::asio_tls_client>::
426 connection_ptr con = _client.get_connection(_url, ec);
427 if (ec) {
428 blog(LOG_INFO, "TwitchChatConnection failed: %s",
429 ec.message().c_str());
430 } else {
431 _client.connect(con);
432 _connection = connection_hdl(con);
433 _client.run();
434 }
435
436 if (_stop) {
437 break;
438 }
439
440 blog(LOG_INFO,
441 "TwitchChatConnection trying to reconnect to in %ld seconds.",
442 (long int)reconnectDelay.count());
443 std::unique_lock<std::mutex> lock(_waitMtx);
444 _cv.wait_for(lock, std::chrono::seconds(reconnectDelay));
445 }
446 _state = State::DISCONNECTED;
447}
448
449void TwitchChatConnection::Connect()
450{

Callers

nothing calls this directly

Calls 4

countMethod · 0.80
resetMethod · 0.45
c_strMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected