Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 963be4d7 authored by Alex Elder's avatar Alex Elder
Browse files

libceph: move prepare_write_banner()



One of the arguments to prepare_write_connect() indicates whether it
is being called immediately after a call to prepare_write_banner().
Move the prepare_write_banner() call inside prepare_write_connect(),
and reinterpret (and rename) the "after_banner" argument so it
indicates that prepare_write_connect() should *make* the call
rather than should know it has already been made.

This was split out from the next patch to highlight this change in
logic.

Signed-off-by: default avatarAlex Elder <elder@dreamhost.com>
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 32eec68d
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -676,7 +676,7 @@ static void prepare_write_banner(struct ceph_messenger *msgr,


static int prepare_write_connect(struct ceph_messenger *msgr,
static int prepare_write_connect(struct ceph_messenger *msgr,
				 struct ceph_connection *con,
				 struct ceph_connection *con,
				 int after_banner)
				 int include_banner)
{
{
	unsigned global_seq = get_global_seq(con->msgr, 0);
	unsigned global_seq = get_global_seq(con->msgr, 0);
	int proto;
	int proto;
@@ -705,7 +705,9 @@ static int prepare_write_connect(struct ceph_messenger *msgr,
	con->out_connect.protocol_version = cpu_to_le32(proto);
	con->out_connect.protocol_version = cpu_to_le32(proto);
	con->out_connect.flags = 0;
	con->out_connect.flags = 0;


	if (!after_banner) {
	if (include_banner)
		prepare_write_banner(msgr, con);
	else {
		con->out_kvec_left = 0;
		con->out_kvec_left = 0;
		con->out_kvec_bytes = 0;
		con->out_kvec_bytes = 0;
	}
	}
@@ -1846,7 +1848,6 @@ static int try_write(struct ceph_connection *con)


	/* open the socket first? */
	/* open the socket first? */
	if (con->sock == NULL) {
	if (con->sock == NULL) {
		prepare_write_banner(msgr, con);
		prepare_write_connect(msgr, con, 1);
		prepare_write_connect(msgr, con, 1);
		prepare_read_banner(con);
		prepare_read_banner(con);
		set_bit(CONNECTING, &con->state);
		set_bit(CONNECTING, &con->state);