Skip to content

Commit d331a5a

Browse files
committed
Asyncify (almost) all the things!
1 parent 282beb5 commit d331a5a

File tree

7 files changed

+352
-167
lines changed

7 files changed

+352
-167
lines changed

Signal-Windows.Lib/IncomingMessages.cs

Lines changed: 53 additions & 53 deletions
Large diffs are not rendered by default.

Signal-Windows.Lib/OutgoingMessages.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void SendMessage(SignalServiceSyncMessage message)
6565
}
6666
}
6767

68-
public void HandleOutgoingMessages()
68+
public async Task HandleOutgoingMessages()
6969
{
7070
Logger.LogDebug("HandleOutgoingMessages()");
7171
while (!Token.IsCancellationRequested)
@@ -92,7 +92,7 @@ public void HandleOutgoingMessages()
9292
else
9393
{
9494
List<SignalServiceAddress> recipients = new List<SignalServiceAddress>();
95-
SignalGroup g = SignalDBContext.GetOrCreateGroupLocked(outgoingSignalMessage.ThreadId, 0);
95+
SignalGroup g = await SignalDBContext.GetOrCreateGroupLocked(outgoingSignalMessage.ThreadId, 0);
9696
foreach (GroupMembership sc in g.GroupMemberships)
9797
{
9898
if (sc.Contact.ThreadId != SignalLibHandle.Instance.Store.Username)
@@ -132,7 +132,7 @@ public void HandleOutgoingMessages()
132132
}
133133
foreach (UntrustedIdentityException e in identityExceptions)
134134
{
135-
Handle.HandleOutgoingKeyChangeLocked(e.E164number, Base64.EncodeBytes(e.IdentityKey.serialize()));
135+
await Handle.HandleOutgoingKeyChangeLocked(e.E164number, Base64.EncodeBytes(e.IdentityKey.serialize()));
136136
}
137137
}
138138
catch (RateLimitException)
@@ -144,15 +144,15 @@ public void HandleOutgoingMessages()
144144
{
145145
Logger.LogError("HandleOutgoingMessages() could not send due to untrusted identities");
146146
outgoingSignalMessage.Status = SignalMessageStatus.Failed_Identity;
147-
Handle.HandleOutgoingKeyChangeLocked(e.E164number, Base64.EncodeBytes(e.IdentityKey.serialize()));
147+
await Handle.HandleOutgoingKeyChangeLocked(e.E164number, Base64.EncodeBytes(e.IdentityKey.serialize()));
148148
}
149149
catch (Exception e)
150150
{
151151
var line = new StackTrace(e, true).GetFrames()[0].GetFileLineNumber();
152152
Logger.LogError("HandleOutgoingMessages() failed in line {0}: {1}\n{2}", line, e.Message, e.StackTrace);
153153
outgoingSignalMessage.Status = SignalMessageStatus.Failed_Unknown;
154154
}
155-
Handle.HandleMessageSentLocked(outgoingSignalMessage);
155+
await Handle.HandleMessageSentLocked(outgoingSignalMessage);
156156
}
157157
Logger.LogInformation("HandleOutgoingMessages() finished");
158158
}

Signal-Windows.Lib/Signal-Windows.Lib.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
</ItemGroup>
167167
<ItemGroup>
168168
<PackageReference Include="libsignal-service-dotnet">
169-
<Version>2.7.5.8</Version>
169+
<Version>2.7.5.9</Version>
170170
</PackageReference>
171171
<PackageReference Include="Microsoft.EntityFrameworkCore">
172172
<Version>1.1.4</Version>

0 commit comments

Comments
 (0)