Created some documentation of how to add synchronization functionality for a new user data type to Weave. Created a new directory called docs to put this into.

This commit is contained in:
jonathandicarlo@jonathan-dicarlos-macbook-pro.local 2008-05-19 19:40:45 -07:00
parent 2c39623eab
commit 7793fe3db1
4 changed files with 33 additions and 11 deletions

View File

@ -69,14 +69,23 @@ The ejabberd process is started simply by running:
Outstanding Issues -- bugs and things to do.
* The test above is failing with a timeout. How to debug this? Let's start
by making it two processes again and seeing if that makes a difference...
Nope. It doesn't. Bob just gets an HTTP status 0
* Occasionally (by which I mean, randomly) the server will respond to
a request with an HTTP status 0. Generally things will go back to
normal with the next request and then keep working, so it's not
a POST with an HTTP status 0. Generally things will go back to
normal with the next POST and then keep working, so it's not
actually preventing anything from working, but I don't understand
what status 0 means and that makes me uncomfortable as it could be
hiding other problems.
What if I modify the sending code to repeat the sending of any messages
that result in HTTP status 0?
-- seems to work, but doesn't help. (It's not HTTP status 0 that's preventing
the test from passing...)
* Occasionally (randomly) a message is received that has a raw integer
for a messageElem, which causes XML parsing of the incoming message
to fail. I don't see any pattern for the values of the raw

View File

@ -164,6 +164,7 @@ HTTPPollingTransport.prototype = {
this._callbackObject = null;
this._useKeys = useKeys;
this._interval = interval;
this._outgoingRetryBuffer = "";
},
__request: null,
@ -263,17 +264,28 @@ HTTPPollingTransport.prototype = {
//Callback for XMLHTTPRequest object state change messages
if ( request.readyState == 4 ) {
if ( request.status == 200) {
// 200 means success.
dump( "Server says: " + request.responseText + "\n" );
// Look for a set-cookie header:
var latestCookie = request.getResponseHeader( "Set-Cookie" );
if ( latestCookie.length > 0 ) {
self._setIdFromCookie( self, latestCookie );
}
// Respond to any text we get back from the server in response
if ( callbackObj != null && request.responseText.length > 0 ) {
callbackObj.onIncomingData( request.responseText );
}
} else {
dump ( "Error! Got HTTP status code " + request.status + "\n" );
if ( request.status == 0 ) {
/* Sometimes the server gives us HTTP status code 0 in response
to an attempt to POST. I'm not sure why this happens, but
if we re-send the POST it seems to usually work the second
time. So put the message into a buffer and try again later:
*/
self._outgoingRetryBuffer = requestXml;
}
}
}
};
@ -300,10 +312,14 @@ HTTPPollingTransport.prototype = {
/* having a notify method makes this object satisfy the nsITimerCallback
interface, so the object can be passed to timer.initWithCallback. */
/* Periodically, if we don't have anything else to post, we should
post an empty message just to see if the server has any queued
data it's waiting to give us in return. */
this._doPost( "" );
/* With HTTPPolling, we need to be contacting the server on a regular
heartbeat, even if we don't have anything to send, just to see if
the server has any data it's waiting to give us.
If we have a message waiting in the outgoingRetryBuffer, send that;
otherwise send nothing. */
var outgoingMsg = this._outgoingRetryBuffer
this._outgoingRetryBuffer = "";
this._doPost( outgoingMsg );
},
connect: function() {

View File

@ -288,7 +288,7 @@ XmppClient.prototype = {
_makeMessageXml: function( messageText, fullName, recipient ) {
/* a "message stanza". Note the message element must have the
full namespace info or it will be rejected. */
msgXml = "<message xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='" + fullName + "' to='" + recipient + "' xml:lang='en'><body>" + messageText + "</body></message>";
var msgXml = "<message xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='" + fullName + "' to='" + recipient + "' xml:lang='en'><body>" + messageText + "</body></message>";
dump( "Message xml: \n" );
dump( msgXml );
return msgXml;

View File

@ -48,7 +48,7 @@ function run_test() {
do_throw( "Timed out waiting for message." );
}
};
timer.initWithCallback( timerResponder, 10000, timer.TYPE_ONE_SHOT );
timer.initWithCallback( timerResponder, 20000, timer.TYPE_ONE_SHOT );
// Handler that listens for the incoming message:
@ -71,16 +71,13 @@ function run_test() {
alice.waitForConnection();
do_check_neq( alice._connectionStatus, alice.FAILED );
dump( "Is test over? " + testIsOver + "\n" );
// Send the message
bob.sendMessage( "alice@" + jabberDomain, sometext );
dump( "Is test over? " + testIsOver + "\n" );
// Wait until either the message is received, or the timeout expires.
var currentThread = threadManager.currentThread;
while( !testIsOver ) {
currentThread.processNextEvent( true );
}
dump( "I'm past the while loop!\n " );
alice.disconnect();
bob.disconnect();