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 XMPPIncomingFileTransfer stucks on state XMPPIFTStateWaitingForSIOffer #1094

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Cyanide7523
Copy link

@Cyanide7523 Cyanide7523 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.
@Cyanide7523 Cyanide7523 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