Skip to content

Conversation

@poca-p0ca
Copy link

@poca-p0ca poca-p0ca commented Sep 28, 2018

fixed XMPPIncomingFileTransfer stucks on state XMPPIFTStateWaitingForSIOffer when receiving disco#info result while client is sending a file.

if XMPPOutgoingFileTransfer and XMPPIncomingFileTransfer are both activated, XMPPOutgoingFileTransfer sends disco#info request to recipient client, and when recipient returns disco#info result, client's XMPPIncomingFileTransfer sends disco#info identity and makes its state to XMPPIFTStateWaitingForSIOffer.

if ((_transferState == XMPPIFTStateNone) && [self isDiscoInfoIQ:iq]) {
    [self sendIdentity:iq];
    _transferState = XMPPIFTStateWaitingForSIOffer;
      
      return YES;
  }

Since -isDiscoInfoIQ: doesn't checks whether it's a result or request or something, unless disco#info iq was result, -isDiscoInfoIQ: will return true.

So unless XMPPStream receives disco#info request, XMPPIncomingfileTransfer's state is not a XMPPIFTStateNone, so disco#info result will never be sended.

Therefore, it need to check whether it's a result or request, I implemented some codes which checks the iq message's state.

if ((_transferState == XMPPIFTStateNone) && [self isDiscoInfoIQ:iq]) {
    if ([iq type] != @"result" || [[iq elementForName:@"query"] elementForName:@"identity"] == nil) {
      [self sendIdentity:iq];
      _transferState = XMPPIFTStateWaitingForSIOffer;
      
      return YES;
    }
  }

fixed XMPPIncomingFileTransfer is stuck on state "XMPPIFTWaitingForSIOffer" when receiving disco#info while sending a file.
@poca-p0ca poca-p0ca changed the title Update XMPPIncomingFileTransfer.m Fixed XMPPIncomingFileTransfer stucks on state XMPPIFTStateWaitingForSIOffer Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant