Rahul
Rahul

Reputation: 5844

How to set Invitation Request Connection Timeout with XMPPFramework?

How can I set the timeout in XMPP? As far as I searched I found there are two timeouts.

  1. Timeout during which App tries to make connection with Server. This timeout is configurable:
[_xmppStream connectWithTimeout:kTimeOutForChat error:&error]
  1. Timeout at which XMPPStream checks for invitation approval/Decline after connection with Spark is in Library File.

I'm searching for solutions to allow me to configure second timeout without modifying the library.

 FileName : XMPPStream.m
 #define TIMEOUT_XMPP_READ_STREAM   -1

I want this -1 to 40. I don't want to edit the Library file. Is there any way I can set without modifying the Library?

EDIT: Code Near TimeOut Macro

  /**
  * Seeing a return statements within an inner block
  * can sometimes be mistaken for a return point of the enclosing method.
   * This makes inline blocks a bit easier to read.
   **/
   #define return_from_block  return

  // Define the timeouts (in seconds) for retreiving various parts of the XML stream
  #define TIMEOUT_XMPP_WRITE         -1
  #define TIMEOUT_XMPP_READ_START    10
  #define TIMEOUT_XMPP_READ_STREAM   40

 // Define the tags we'll use to differentiate what it is we're currently reading or writing
 #define TAG_XMPP_READ_START         100
 #define TAG_XMPP_READ_STREAM        101
 #define TAG_XMPP_WRITE_START        200
 #define TAG_XMPP_WRITE_STOP         201
 #define TAG_XMPP_WRITE_STREAM       202
 #define TAG_XMPP_WRITE_RECEIPT      203

 // Define the timeouts (in seconds) for SRV

Upvotes: 1

Views: 280

Answers (2)

JAL
JAL

Reputation: 42469

You can re-define the preprocessor macro in your app.

#undef  TIMEOUT_XMPP_WRITE
#define TIMEOUT_XMPP_WRITE 40

This might cause more confusion with your developers, and I would use this with caution.

Upvotes: 1

Wain
Wain

Reputation: 119031

If the code had an #ifdef to check if the define already existed then you could use the preprocessor to define the value you want. But, it doesn't, so I can't think of an easy was to use the preprocessor to replace it and keep it compilable.

The simplest solution is just to fork the project and maintain a small change. This should be a low cost solution as your change will be limited to a single line and merging upstream changes should (generally) be automatic.

Upvotes: 1

Related Questions