我最近在我的Arch linux机器上从github编译了最新的ejabberd代码。我是ejabberd的新手,所以我可能犯了一个新手的错误。
我遇到的问题是,在特定情况下,数据包无法到达目标客户端。如果在客户端断开连接后发送邮件,但客户端会话因resume_timeout而关闭之前,则会发生这种情况。
我按照https://www.ejabberd.im/faq/tcp提到的说明进行了操作,但我仍然无法处理所有情况。
我的ejabberd.yml的相关部分看起来像
listen:
-
port: 5222
module: ejabberd_c2s
max_stanza_size: 65536
resend_on_timeout: true
resume_timeout: 60
shaper: c2s_shaper
access: c2s
-
## Not sure if resend_on_timeout is required here
port: 5280
module: ejabberd_http
resend_on_timeout: true
resume_timeout: 60
http_bind: true
modules:
...
mod_offline:
access_max_user_messages: max_user_offline_messages
mod_ping:
send_pings: true
ping_interval: 60
timeout_action: kill
这是与客户的活动相对应的ejabberd日志的输出:
客户端A断开连接
2016-06-19 10:59:51.369 [info] <0.549.0>@ejabberd_c2s:fsm_next_state:2454 Waiting for resumption of stream for 9739937980@gappi.in/Smack`
客户端B登录并向A
发送消息2016-06-19 11:00:00.320 [info] <0.510.0>@ejabberd_listener:accept:333 (#Port<0.19876>) Accepted connection 139.162.34.247:41186 -> 139.162.34.247:5222
2016-06-19 11:00:00.575 [info] <0.559.0>@ejabberd_c2s:wait_for_sasl_response:900 ({socket_state,fast_tls,{tlssock,#Port<0.19876>,#Port<0.19877>},<0.558.0>}) Accepted authentication for echo by undefined from 137
2016-06-19 11:00:00.715 [info] <0.559.0>@ejabberd_c2s:open_session:1111 ({socket_state,fast_tls,{tlssock,#Port<0.19876>,#Port<0.19877>},<0.558.0>}) Opened session for echo@gappi.in/13353511976792329881266
2016-06-19 11:00:00.776 [info] <0.559.0>@ejabberd_c2s:handle_enable:2700 Stream management with resumption enabled for echo@gappi.in/13353511976792329881266
2016-06-19 11:00:00.984 [info] <0.559.0>@ejabberd_c2s:terminate:1778 ({socket_state,fast_tls,{tlssock,#Port<0.19876>,#Port<0.19877>},<0.558.0>}) Close session for echo@gappi.in/13353511976792329881266
由于resume_timeout
,客户端最终会被关闭2016-06-19 11:00:51.370 [info] <0.549.0>@ejabberd_c2s:terminate:1778 ({socket_state,gen_tcp,#Port<0.19869>,<0.548.0>}) Close session for 9739937980@gappi.in/Smack
客户端A重新登录
2016-06-19 11:01:14.078 [info] <0.510.0>@ejabberd_listener:accept:333 (#Port<0.19879>) Accepted connection 122.172.241.21:26597 -> 139.162.34.247:5222
2016-06-19 11:01:14.707 [info] <0.566.0>@ejabberd_c2s:wait_for_sasl_response:900 ({socket_state,gen_tcp,#Port<0.19879>,<0.565.0>}) Accepted authentication for 9739937980 by undefined from 122.172.241.21
2016-06-19 11:01:14.868 [info] <0.566.0>@ejabberd_c2s:open_session:1111 ({socket_state,gen_tcp,#Port<0.19879>,<0.565.0>}) Opened session for 9739937980@gappi.in/Smack
2016-06-19 11:01:14.966 [info] <0.566.0>@ejabberd_c2s:handle_enable:2700 Stream management with resumption enabled for 9739937980@gappi.in/Smack
根据本指南https://www.ejabberd.im/faq/tcp,在resume_timeout到期后,未应用的消息应该由mod_offline处理。但这不会发生。
结果:没有消息到达客户端。
任何指针?
答案 0 :(得分:0)
此问题是由于Ejabberd https://github.com/processone/ejabberd/issues/1160中的一个错误导致的,现在已修复。