test fencing

This commit is contained in:
DennisSchiefer 2012-03-13 22:39:28 +01:00
parent c5a8ec7c31
commit ec27881f39
2 changed files with 9 additions and 5 deletions

View File

@ -23,6 +23,10 @@ OSRM.JSONP = {
// wrap timeout function // wrap timeout function
OSRM.JSONP.timeouts[id] = function(response) { OSRM.JSONP.timeouts[id] = function(response) {
if( OSRM.JSONP.fences[id] == undefined ){ // fence to prevent execution after timeout function (when precompiled!)
//OSRM.debug.log("x");
return;
}
timeout_function(response); timeout_function(response);
// var jsonp = document.getElementById('jsonp_'+id); // clean DOM // var jsonp = document.getElementById('jsonp_'+id); // clean DOM
@ -41,8 +45,10 @@ OSRM.JSONP = {
clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer
OSRM.JSONP.timers[id] = undefined; OSRM.JSONP.timers[id] = undefined;
if( OSRM.JSONP.fences[id] == undefined ) // fence to prevent execution after timeout function (when precompiled!) if( OSRM.JSONP.fences[id] == undefined ){ // fence to prevent execution after timeout function (when precompiled!)
return; //OSRM.debug.log("y");
return;
}
callback_function(response); // actual wrapped callback callback_function(response); // actual wrapped callback

View File

@ -56,10 +56,8 @@ function showRouteSimple(response) {
if(!response) if(!response)
return; return;
if (OSRM.JSONP.fences.route) { // is this still needed? if (OSRM.JSONP.fences.route) // prevent simple routing when real routing is done!
OSRM.debug.log("fenced");
return; return;
}
if( response.status == 207) { if( response.status == 207) {
showNoRouteGeometry(); showNoRouteGeometry();