X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=blobdiff_plain;f=0.6.x%2Fjs%2F06_net%2F00_XNet.js;fp=0.6.x%2Fjs%2F06_net%2F00_XNet.js;h=7d5b26ffa99d59e62d0dd9aaec8bda517afc844d;hp=469669d72a9379741bf6c633122c85376294a02e;hb=2bea17ee282c2cf4ce0de6685db3ade602f6e60f;hpb=76ea1040608829b653422cf51b3490801d2ec1fa diff --git a/0.6.x/js/06_net/00_XNet.js b/0.6.x/js/06_net/00_XNet.js index 469669d..7d5b26f 100644 --- a/0.6.x/js/06_net/00_XNet.js +++ b/0.6.x/js/06_net/00_XNet.js @@ -242,13 +242,13 @@ function X_NET_proxyDispatch( e ){ this[ 'unlisten' ]( X_EVENT_COMPLETE, X_NET_proxyDispatch ) [ 'dispatch' ]( X_EVENT_COMPLETE ); }; - X_NET_shiftQueue(); + X_NET_shiftQueue( true ); X_Pair_release( this ); X_NET_completePhase = 0; } else if( this === X_NET_currentQueue ){ X_NET_currentWrapper.cancel(); - X_NET_shiftQueue(); + X_NET_shiftQueue( true ); flag = true; } else if( ( i = X_NET_QUEUE_LIST.indexOf( this ) ) !== -1 ){ @@ -289,11 +289,12 @@ function X_NET_proxyDispatch( e ){ }; }; -function X_NET_shiftQueue(){ - var auth, authSettings; +// TODO _busy は X.Net で触る. +function X_NET_shiftQueue( currentKilled ){ + var q, auth, authSettings; if( X_NET_currentQueue ){ - if( X_NET_currentWrapper._busy ) return; + if( !currentKilled ) return; X_NET_currentWrapper [ 'unlisten' ]( [ X_EVENT_PROGRESS, X_EVENT_SUCCESS, X_EVENT_ERROR ], X_NET_currentQueue, X_NET_proxyDispatch ) @@ -307,7 +308,7 @@ function X_NET_shiftQueue(){ if( !X_NET_QUEUE_LIST.length ) return; - X_NET_currentQueue = X_NET_QUEUE_LIST.shift(); + X_NET_currentQueue = q = X_NET_QUEUE_LIST.shift(); X_NET_currentData = X_Pair_get( X_NET_currentQueue ); switch( X_NET_currentData.netType ){ @@ -335,12 +336,17 @@ function X_NET_shiftQueue(){ case 1 : case 2 : if( !( auth[ 'dispatch' ]( X_EVENT_NEED_AUTH ) & X_CALLBACK_PREVENT_DEFAULT ) ){ - authSettings.lazyRequests = authSettings.lazyRequests || []; - authSettings.lazyRequests.indexOf( X_NET_currentQueue ) === -1 && authSettings.lazyRequests.push( X_NET_currentQueue ); + // event 内で kill されていないことを確認 + if( X_NET_currentQueue === q ){ + authSettings.lazyRequests = authSettings.lazyRequests || []; + authSettings.lazyRequests.indexOf( q ) === -1 && authSettings.lazyRequests.push( q ); + X_NET_currentQueue = null; + X_NET_shiftQueue(); + }; + } else { + X_NET_currentQueue === q && q[ 'kill' ](); }; - X_NET_currentQueue = null; - X_NET_shiftQueue(); - break; + return; case 3 : // refresh token X_NET_QUEUE_LIST.push( X_NET_currentQueue ); X_NET_currentQueue = null;