File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,27 @@ void MoonlightSession::connection_started() {
7777}
7878
7979void MoonlightSession::connection_terminated (int error_code) {
80- brls::Logger::info (" MoonlightSession: Connection terminated..." );
80+ brls::Logger::info (" MoonlightSession: Connection terminated with code: {}" , error_code);
81+
82+ if (error_code != 0 ) {
83+ if (!m_active_session) return ;
84+ brls::Logger::info (" MoonlightSession: Reconnection attempt" );
85+
86+ m_active_session->stop (false );
87+
88+ m_active_session->start ([](const GSResult<bool >& result) {
89+ if (result.isSuccess ()) {
90+ brls::Logger::info (" MoonlightSession: Reconnected" );
91+ } else {
92+ brls::Logger::info (" MoonlightSession: Reconnection failed" );
93+ if (m_active_session) {
94+ m_active_session->m_is_active = false ;
95+ m_active_session->m_is_terminated = true ;
96+ }
97+ }
98+ });
99+ return ;
100+ }
81101
82102 if (m_active_session) {
83103 m_active_session->m_is_active = false ;
You can’t perform that action at this time.
0 commit comments