Tom Lane wrote:
>"Stephen R. van den Berg" <srb@cuci.nl> writes:
>> What about simply closing the filedescriptor upon discovering a
>> non-empty sendbuffer upon timeout/querycancel?
>So in other words, convert any network glitch, no matter how small,
>into an instant fatal error?
The fact that a timeout or querycancel has taken place, indicates that
this does *not* act on just any network glitch.
The preferred exact logic would look something like:
a. Take note of the time the last write returned as Tlastwritten.
b. Whenever a timeout occurs, or a querycancel is being requested:
c. Check if the sendbuffer is empty.
d. If the sendbuffer is non-empty *and* Tlastwritten is longer ago than some Tkill (say 128 seconds), then close the
filedescriptor.
In all other cases, just hang on tight.
--
Sincerely, Stephen R. van den Berg.
Teamwork is essential -- it allows you to blame someone else.