You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [SDLProtocolMessageAssembler handleMessage], the completionHandler is always called with done set to NO at the end of the function, even if the message assembly was completed.
if (self.parts.count == self.frameCount + 1) { // +1 since we also require the first-frame
...
// Execute completion handler.if (completionHandler != nil) {
completionHandler(YES, assembledMessage);
}
// Done with this data, release it.
self.parts = nil;
}
// Not done, let caller knowif (completionHandler != nil) {
completionHandler(NO, nil);
}
This results in the completionHandler being called twice when the message assembly is completed, once claiming that it was completed, and once claiming that it wasn't.
The last if statement should just be changed to an else if so that only one of the calls can be run.
if (self.parts.count == self.frameCount + 1) { // +1 since we also require the first-frame
...
// Execute completion handler.if (completionHandler != nil) {
completionHandler(YES, assembledMessage);
}
// Done with this data, release it.
self.parts = nil;
}
// Not done, let caller knowelseif (completionHandler != nil) {
completionHandler(NO, nil);
}
The text was updated successfully, but these errors were encountered:
@jacobkeeler Probably a little nit picky but I think to be more clear about what is going on in this code it should actually read
// Not done, let caller knowelse {
if (completionHandler != nil) {
completionHandler(NO, nil);
}
}
because the if statement only determines if there is a completionHandler to call, and in the case that there were other operations to perform if the message assembly hasn't completed (not that there are), they should not be blocked by a nil completion handler
In
[SDLProtocolMessageAssembler handleMessage]
, thecompletionHandler
is always called withdone
set toNO
at the end of the function, even if the message assembly was completed.This results in the
completionHandler
being called twice when the message assembly is completed, once claiming that it was completed, and once claiming that it wasn't.The last
if
statement should just be changed to anelse if
so that only one of the calls can be run.The text was updated successfully, but these errors were encountered: