]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
crimson: pass `Connection*` to Dispatch::ms_dispatch()
authorKefu Chai <kchai@redhat.com>
Fri, 19 Apr 2019 08:50:25 +0000 (16:50 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 20 Apr 2019 05:58:32 +0000 (13:58 +0800)
commitc69bf0c002f1b62283b3eb5df62fdcb65963b4ae
tree7fab5868a3734002bf8851bbc045c2a6db5427ff
parent42e129cd3ae9d52a37248e8240f38ff9d86ad378
crimson: pass `Connection*` to Dispatch::ms_dispatch()

currently, we use a `with_gate()` in `ProtocolV2::read_message()` for
ensuring that `this` (or `Connection` holding this protocol instance)
will outlive the continuation of `dispatcher.ms_dispatch()` which
references `this->dispatcher`. but we also pass a strong reference of
connection to dispatcher. in short, we have *two* safeguards for the
same purpose.

in this change, one of these safeguards is removed -- to pass the raw
pointer of `Connection` to `Dispatch::ms_dispatch()`. the reason why
the `with_gate()` is kept is that, if we have removed `with_gate()` in
Protocol, we need to

1. let `Dispatcher::ms_dispatch()` return `void`, as it should not block
any succeeding calls.
2. add a `with_gate()` in `Dispatcher::ms_dispatch()` to ensure that
`this` is alive during the lifecycle of the continuation(s) in
`Dispatcher::ms_dispatch()`.

Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
Signed-off-by: Kefu Chai <kchai@redhat.com>
14 files changed:
src/crimson/mgr/client.cc
src/crimson/mgr/client.h
src/crimson/mon/MonClient.cc
src/crimson/mon/MonClient.h
src/crimson/net/Dispatcher.h
src/crimson/net/ProtocolV1.cc
src/crimson/net/ProtocolV2.cc
src/crimson/osd/chained_dispatchers.cc
src/crimson/osd/chained_dispatchers.h
src/crimson/osd/heartbeat.cc
src/crimson/osd/heartbeat.h
src/test/crimson/perf_crimson_msgr.cc
src/test/crimson/test_alien_echo.cc
src/test/crimson/test_messenger.cc