[Standards-JIG] Closing idle streams
jajcus at jajcus.net
Fri Jun 2 15:38:05 UTC 2006
On Fri, Jun 02, 2006 at 03:27:00PM +0100, Dave Cridland wrote:
> Send the stream error and the stream close, half close, and wait for
> the remote end to close the socket, same as for any stream error.
You assume this case should be handled like an error (is error)? Lets
look what could be the result...
> You're looking at, approximately:
> int fd;
> send( fd, "<stream:error>[...]</stream:error></stream:stream>", n );
> shutdown( fd, SHUT_WR ); /* half-close */
> /* Read data until remote end closes */
> close( fd );
> Remote end behaves either by closing the socket immediately after
> half-close, or by formally sending "</stream:stream>" back to
> confirm, and then closing.
Ok. And what should be done with the "data until remote end closes"?
Should this still be handled like "any stream error"?
Regular stream errors mean conditions when the stream is invalid. Eg.
XML not well formed. All the server can do with the data received after
detecting such error is ignore it. Much better is to close the connetion
at once in this case, than waiting for anythig.
In case of closing idle connection server has nothing to send, but
should accept and proccess anything other side sends (that could, of
course, cause a new outgoing connection being opened).
IMHO S2S connections are _temporary_ channels for exchanging stanza
when neccessary. Closing them is as normal thing as disconnecting
a client when the user decides to stop using it. It should not be
treated as error. IMO closing stream with </stream:stream> and letting
the other side do the same is the most elegant solution possible with
current protocol. Anything more that could be invented would be
something like <presence type="unavailable"/> used in C2S connections.
But that is not necessary.
More information about the Standards