mirror of https://github.com/schoebel/mars
net: don't update Lamport clock too often
This commit is contained in:
parent
104b3a522a
commit
d9d31d831e
|
@ -1164,6 +1164,7 @@ int mars_send_mref(struct mars_socket *msock, struct mref_object *mref, bool cor
|
|||
if (mref->ref_rw != 0 && mref->ref_data && mref->ref_cs_mode < 2)
|
||||
cmd.cmd_code |= CMD_FLAG_HAS_DATA;
|
||||
|
||||
if (!cork || !msock->s_pos)
|
||||
get_lamport(NULL, &cmd.cmd_stamp);
|
||||
|
||||
status = desc_send_struct(msock, &cmd, mars_cmd_meta, true);
|
||||
|
@ -1191,6 +1192,7 @@ int mars_recv_mref(struct mars_socket *msock, struct mref_object *mref, struct m
|
|||
if (status < 0)
|
||||
goto done;
|
||||
|
||||
if (cmd->cmd_stamp.tv_sec)
|
||||
set_lamport(&cmd->cmd_stamp);
|
||||
|
||||
if (cmd->cmd_code & CMD_FLAG_HAS_DATA) {
|
||||
|
@ -1221,6 +1223,7 @@ int mars_send_cb(struct mars_socket *msock, struct mref_object *mref, bool cork)
|
|||
if (mref->ref_rw == 0 && mref->ref_data && mref->ref_cs_mode < 2)
|
||||
cmd.cmd_code |= CMD_FLAG_HAS_DATA;
|
||||
|
||||
if (!cork || !msock->s_pos)
|
||||
get_lamport(NULL, &cmd.cmd_stamp);
|
||||
|
||||
status = desc_send_struct(msock, &cmd, mars_cmd_meta, true);
|
||||
|
@ -1249,6 +1252,7 @@ int mars_recv_cb(struct mars_socket *msock, struct mref_object *mref, struct mar
|
|||
if (status < 0)
|
||||
goto done;
|
||||
|
||||
if (cmd->cmd_stamp.tv_sec)
|
||||
set_lamport(&cmd->cmd_stamp);
|
||||
|
||||
if (cmd->cmd_code & CMD_FLAG_HAS_DATA) {
|
||||
|
|
Loading…
Reference in New Issue