2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
|
f.running = true;
Chat._isBatchLoading = f.isFirstCall;
if(true===f.isFirstCall){
f.isFirstCall = false;
Chat.pendingOnError = undefined;
Chat.ajaxStart();
Chat.e.viewMessages.classList.add('loading');
if(1) setInterval(
/*
We manager onerror() results in poll() using a
stack of error objects and we delay their handling by
a small amount, rather than immediately when the
exception arrives.
This level of indirection is necessary to be able to
unambiguously identify client-timeout-specific polling
errors from other errors. Timeouts are always announced in
pairs of an HTTP 0 and something we can unambiguously
identify as a timeout. When we receive an HTTP 0 we put it
into this queue. If an ontimeout() call arrives before this
error is handled, this error is removed from the stack. If,
however, an HTTP 0 is seen in this stack without an
accompanying timeout, we handle it from here.
It's kinda like in the curses C API, where you to match
ALT-X by first getting an ESC event, then an X event, but
this one is a lot less explicable. (It's almost certainly a
mis-handling bug in F.fetch(), but it has so far eluded my
eyes.)
*/
()=>{
if( Chat.pendingOnError ){
const x = Chat.pendingOnError;
Chat.pendingOnError = undefined;
afterPollFetch(x);
}
},
1000
);
}
let nErr = 0;
F.fetch("chat-poll",{
timeout: Chat.timer.pollTimeout,
urlParams:{
name: Chat.mxMsg
},
|
<
|
|
<
|
<
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
>
|
|
|
|
|
|
<
<
|
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
|
f.running = true;
Chat._isBatchLoading = f.isFirstCall;
if(true===f.isFirstCall){
f.isFirstCall = false;
Chat.pendingOnError = undefined;
Chat.ajaxStart();
Chat.e.viewMessages.classList.add('loading');
/*
We manager onerror() results in poll() in a roundabout
manner: when an onerror() arrives, we stash it aside
for a moment before processing it.
This level of indirection is necessary to be able to
unambiguously identify client-timeout-specific polling errors
from other errors. Timeouts are always announced in pairs of
an HTTP 0 and something we can unambiguously identify as a
timeout (in that order). When we receive an HTTP error we put
it into this queue. If an ontimeout() call arrives before
this error is handled, this error is ignored. If, however, an
HTTP error is seen without an accompanying timeout, we handle
it from here.
It's kinda like in the curses C API, where you to match
ALT-X by first getting an ESC event, then an X event, but
this one is a lot less explicable. (It's almost certainly a
mis-handling bug in F.fetch(), but it has so far eluded my
eyes.)
*/
f.delayPendingOnError = function(err){
if( Chat.pendingOnError ){
const x = Chat.pendingOnError;
Chat.pendingOnError = undefined;
afterPollFetch(x);
}
};
}
let nErr = 0;
F.fetch("chat-poll",{
timeout: Chat.timer.pollTimeout,
urlParams:{
name: Chat.mxMsg
},
|
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
|
},
onerror:function(err){
Chat._isBatchLoading = false;
if(Chat.beVerbose){
console.error("poll.onerror:",err.name,err.status,JSON.stringify(err));
}
Chat.pendingOnError = err;
},
onload:function(y){
reportConnectionOkay('poll.onload', true);
newcontent(y);
if(Chat._isBatchLoading){
Chat._isBatchLoading = false;
Chat.updateActiveUserList();
|
>
|
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
|
},
onerror:function(err){
Chat._isBatchLoading = false;
if(Chat.beVerbose){
console.error("poll.onerror:",err.name,err.status,JSON.stringify(err));
}
Chat.pendingOnError = err;
setTimeout(f.delayPendingOnError, 250);
},
onload:function(y){
reportConnectionOkay('poll.onload', true);
newcontent(y);
if(Chat._isBatchLoading){
Chat._isBatchLoading = false;
Chat.updateActiveUserList();
|