On Pn, 2007-12-10 at 21:55 +0800, 杨帅 wrote:
> 1 About sx_raw_write(sx_t s, char* buf, int len) function.
> This function is invoked by xxx_time_checks() function, for
> example _router_time_checks in the file main.c(router).
> I see that the sentence "sx_raw_write(target->s, " ", 1)" want
> to check the connection with other components.
This is so-called "TCP keepalive".
You see sometimes when the TCP connection is torn down by a routing
party, only one of the sides of the connection is informed and closed
properly (ex. c2s end). The other side "thinks" the connection is still
open, just does not transmit any data.
Thus sending a whitespace character through torn connection would result
in error, effectivly closing the connection at the sending TCP stack and
informing the application that the connection is broken.
> As usual, when other component(eg c2s) receviev the "conncetion
> test message", it should response some message for it.
> But I can't find where c2s process the "connection test
> message"
As you see in the above explanation, there is no need for any c2s
answer, because it is expected to just went through or be handled (as an
error) in TCP stack.
There exist XMPP-Ping XEP, but I think it's to heavy to be used as a
keepalive. Single whitespace character in between stanzas is enough and
effective.
> 2 About the value of comp->s->auth_id.
> In the implementation of fuction _router_process_bind
>
> a) user = strdup(comp->s->auth_id);
> b) c = strchr(user, '@');
> c) if(c != NULL) *c = '\0'; if(strcmp(user, name->domain) != 0
> && !aci_check(comp->r->aci, "bind", user)) {
This code extracts the username from the JID, to compare it against ACI.
It first duplicates the auth_id (a), then searches for the '@' character
in the duplicate (b) and if found (c) chomps the string by inserting NUL
in place of the at-sign (c).
> We can presume that the value of comp->s->auth_id equals
> name->domain's value. For example, name->domain is "c2s",then
> comp->s->auth_id is also "c2s .
No. In case of to-router connections it's always
[EMAIL PROTECTED] By default setup all components use
'jabberd' username.
--
/\_./o__ Tomasz Sterna
(/^/(_^^' Xiaoka.com
._.(_.)_ XMPP: [EMAIL PROTECTED]
_______________________________________________
Jabberd2 mailing list
[email protected]
http://lists.xiaoka.com/listinfo.cgi/jabberd2-xiaoka.com