mirror of
git://git.psyced.org/git/psyced
synced 2024-08-15 03:25:10 +00:00
let the past begone in cvs land. welcome to igit igit!
This commit is contained in:
commit
4e601cf1c7
509 changed files with 77963 additions and 0 deletions
48
world/net/jabber/interserver.c
Normal file
48
world/net/jabber/interserver.c
Normal file
|
@ -0,0 +1,48 @@
|
|||
// $Id: interserver.c,v 1.12 2008/03/11 15:13:58 lynx Exp $ vim:syntax=lpc
|
||||
//
|
||||
// common things for interserver jabber.. included or maybe later inherited by
|
||||
// active.c and gateway.c. i am sure fippo will find some more nice things to
|
||||
// extrapolate into here.. :)
|
||||
|
||||
volatile int flags = 0;
|
||||
|
||||
reboot(reason, restart, pass) {
|
||||
if (pass == 0) {
|
||||
if (interactive(ME)) {
|
||||
flags |= TCP_PENDING_DISCONNECT;
|
||||
STREAM_ERROR("system-shutdown", (restart ? "Server restart: "
|
||||
: "Server shutdown: ")+ reason);
|
||||
// shutdown order pretty much ensures no other data will be
|
||||
// sent over this socket after this message. but it isn't
|
||||
// really enforced.. TODO?
|
||||
}
|
||||
} else
|
||||
destruct(ME);
|
||||
}
|
||||
|
||||
int clean_up(int refcount) {
|
||||
if (interactive(ME)) {
|
||||
// closing the socket without asking the other side will raise
|
||||
// the chances of losing packets. we're not playing that game,
|
||||
// and i'm afraid every jabber server in the world needs to be
|
||||
// fixed if jabber is one day trying to become a reliable thing. -lynX
|
||||
#if 0
|
||||
// that's the 0190 incompliant way to do it
|
||||
STREAM_ERROR("connection-timeout", "just reconnect if you like")
|
||||
remove_interactive(ME);
|
||||
#else
|
||||
// this instead will initiate a clean shutdown of the connection
|
||||
// and is therefore the correct way to timeout a connection.
|
||||
PT(("%O cleaning up: closing stream\n", ME))
|
||||
// close the stream according to XEP 0190
|
||||
emit("</stream:stream>");
|
||||
// flag says the stream is in closing phase and nothing may be
|
||||
// delivered on it. but we aren't enforcing this. TODO!
|
||||
flags |= TCP_PENDING_DISCONNECT;
|
||||
#endif
|
||||
} else if (clonep(ME)) {
|
||||
PT(("%O cleaning up: self destruct\n", ME))
|
||||
destruct(ME);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue