Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Tls version for Windows 10 and Windows 7. #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Firebase.Cloud.Messaging/FcmConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task ConnectAsync()
client.Client.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.TcpKeepAliveTime, 60);

sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);
await sslStream.AuthenticateAsClientAsync(host, null, SslProtocols.Tls13, false).ConfigureAwait(false);
await sslStream.AuthenticateAsClientAsync(host, null, SslProtocols.Tls13 | SslProtocols.Tls12, false).ConfigureAwait(false);
}

public async Task SendAsync(byte[] data, CancellationToken cancellationToken)
Expand Down Expand Up @@ -68,7 +68,7 @@ public async Task ReceiveAsync(CancellationToken cancellationToken)
}

// it seems that if the underlying socket is disconnected no exception is thrown
if (client.Connected == false)
if (!client.Connected || bytesRead == 0)
{
throw new SocketException(1);
}
Expand Down
3 changes: 2 additions & 1 deletion Firebase.Cloud.Messaging/FcmListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ private void GetNextMessage()
byte[] unreadBytes = new byte[unreadBytesCount];

dataStream.Read(unreadBytes, 0, unreadBytes.Length);
dataStream = new MemoryStream(unreadBytes);
dataStream = new MemoryStream(unreadBytes.Length);
dataStream.Write(unreadBytes, 0, unreadBytes.Length);
}
else
{
Expand Down