code optimize: put set_keepalive inside broker module