From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org Cc: vdavydov.dev@gmail.com Subject: [PATCH 1/4] iproto: rename disconnect cmsg to destroy Date: Fri, 7 Dec 2018 18:46:32 +0300 [thread overview] Message-ID: <2168d008e70590a87851bbf602a811d22441b586.1544197465.git.v.shpilevoy@tarantool.org> (raw) In-Reply-To: <cover.1544197465.git.v.shpilevoy@tarantool.org> In-Reply-To: <cover.1544197465.git.v.shpilevoy@tarantool.org> Disconnect cmsg is a message that is used by iproto thread to notify tx thread that a connection is dead and has no outstanding requests. That is its tx-related resourses are freed and the connection is deleted. But the text above is clear definition of destroy. The patch harmonizes cmsg name and its puprose. Secondly, the patch is motivated by #3859 which requires separate disconnect and destroy phases. Needed for #3859 --- src/box/iproto.cc | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/box/iproto.cc b/src/box/iproto.cc index 3d13bad2f..40d456374 100644 --- a/src/box/iproto.cc +++ b/src/box/iproto.cc @@ -271,14 +271,14 @@ enum rmean_net_name { const char *rmean_net_strings[IPROTO_LAST] = { "SENT", "RECEIVED" }; static void -tx_process_disconnect(struct cmsg *m); +tx_process_destroy(struct cmsg *m); static void -net_finish_disconnect(struct cmsg *m); +net_finish_destroy(struct cmsg *m); -static const struct cmsg_hop disconnect_route[] = { - { tx_process_disconnect, &net_pipe }, - { net_finish_disconnect, NULL }, +static const struct cmsg_hop destroy_route[] = { + { tx_process_destroy, &net_pipe }, + { net_finish_destroy, NULL }, }; /** @@ -397,10 +397,10 @@ struct iproto_connection /** Logical session. */ struct session *session; ev_loop *loop; - /* Pre-allocated disconnect msg. */ - struct cmsg disconnect; - /** True if disconnect message is sent. Debug-only. */ - bool is_disconnected; + /** Pre-allocated destroy msg. */ + struct cmsg destroy_msg; + /** True if destroy message is sent. Debug-only. */ + bool is_destroy_sent; struct rlist in_stop_list; /** * Kharon is used to implement box.session.push(). @@ -576,9 +576,9 @@ iproto_connection_close(struct iproto_connection *con) * twice. */ if (iproto_connection_is_idle(con)) { - assert(con->is_disconnected == false); - con->is_disconnected = true; - cpipe_push(&tx_pipe, &con->disconnect); + assert(! con->is_destroy_sent); + con->is_destroy_sent = true; + cpipe_push(&tx_pipe, &con->destroy_msg); } rlist_del(&con->in_stop_list); } @@ -992,8 +992,8 @@ iproto_connection_new(int fd) con->session = NULL; rlist_create(&con->in_stop_list); /* It may be very awkward to allocate at close. */ - cmsg_init(&con->disconnect, disconnect_route); - con->is_disconnected = false; + cmsg_init(&con->destroy_msg, destroy_route); + con->is_destroy_sent = false; con->tx.is_push_pending = false; con->tx.is_push_sent = false; return con; @@ -1204,10 +1204,10 @@ tx_fiber_init(struct session *session, uint64_t sync) * as well as output buffers of the connection. */ static void -tx_process_disconnect(struct cmsg *m) +tx_process_destroy(struct cmsg *m) { struct iproto_connection *con = - container_of(m, struct iproto_connection, disconnect); + container_of(m, struct iproto_connection, destroy_msg); if (con->session) { tx_fiber_init(con->session, 0); if (! rlist_empty(&session_on_disconnect)) @@ -1228,10 +1228,10 @@ tx_process_disconnect(struct cmsg *m) * and close the connection. */ static void -net_finish_disconnect(struct cmsg *m) +net_finish_destroy(struct cmsg *m) { struct iproto_connection *con = - container_of(m, struct iproto_connection, disconnect); + container_of(m, struct iproto_connection, destroy_msg); /* Runs the trigger, which may yield. */ iproto_connection_delete(con); } -- 2.17.2 (Apple Git-113)
next prev parent reply other threads:[~2018-12-07 15:46 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-07 15:46 [PATCH 0/4] Outdate disconnected session Vladislav Shpilevoy 2018-12-07 15:46 ` Vladislav Shpilevoy [this message] 2018-12-07 17:36 ` [tarantool-patches] [PATCH 1/4] iproto: rename disconnect cmsg to destroy Konstantin Osipov 2018-12-11 12:54 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-07 15:46 ` [PATCH 2/4] iproto: fire on_disconnect right after disconnect Vladislav Shpilevoy 2018-12-07 17:37 ` [tarantool-patches] " Konstantin Osipov 2018-12-11 12:55 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-07 15:46 ` [PATCH 3/4] session: introduce 'dead' type Vladislav Shpilevoy 2018-12-07 17:38 ` [tarantool-patches] " Konstantin Osipov 2018-12-07 20:40 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-07 22:21 ` Konstantin Osipov 2018-12-07 22:42 ` Vladislav Shpilevoy 2018-12-07 15:46 ` [PATCH 4/4] session: kill a session of a closed connection Vladislav Shpilevoy 2018-12-07 17:35 ` [tarantool-patches] [PATCH 0/4] Outdate disconnected session Konstantin Osipov 2018-12-11 16:12 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-07 17:41 ` [tarantool-patches] " Konstantin Osipov 2018-12-11 16:13 ` [tarantool-patches] " Vladislav Shpilevoy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=2168d008e70590a87851bbf602a811d22441b586.1544197465.git.v.shpilevoy@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --subject='Re: [PATCH 1/4] iproto: rename disconnect cmsg to destroy' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox