Thoroughbreed / CryptoChat

End-to-end encrypted chat software via gRPC
Apache License 2.0
0 stars 0 forks source link

Dissapearing messages #1

Closed jaa2019 closed 2 years ago

jaa2019 commented 2 years ago

Sometimes messages doesn't go out to all users - but no exceptions are thrown

jaa2019 commented 2 years ago

Replaced

  _output = response.Text;
  try
  {
    _output = _crypto.Decrypt(Convert.FromHexString(response.Text));
  }
  finally
  {
    Console.WriteLine($"{response.User}: {_output}");
  }

With

  try
  {
    _output = _crypto.Decrypt(Convert.FromHexString(response.Text));
  }
  catch (Exception e)
  {
    _output = response.Text;
  }
  Console.WriteLine($"{response.User}: {_output}");

The issue was that the exception if the response was cleartext never got handled, thus resulting in that the thread created with no exception to the main loop. By catching the exception (and doing nothing with it) fixed the issue.