infra: also send prot level over dents

This commit is contained in:
Thomas Schoebel-Theuer 2020-07-08 22:14:03 +02:00
parent e02bd88349
commit 3afad273fd
3 changed files with 8 additions and 0 deletions

View File

@ -89,6 +89,7 @@ extern char *my_id(void);
int d_version; /* dynamic programming per call of mars_ent_work() */ \
int d_child_count; \
int d_hash; \
int d_proto; \
char d_once_error; \
bool d_killme; \
bool d_use_channel; \

View File

@ -98,6 +98,7 @@ const struct meta mars_dent_meta[] = {
META_INI(d_serial, struct mars_dent, FIELD_INT),
META_INI(d_corr_A, struct mars_dent, FIELD_INT),
META_INI(d_corr_B, struct mars_dent, FIELD_INT),
META_INI(d_proto, struct mars_dent, FIELD_INT),
META_INI_SUB(new_stat,struct mars_dent, mars_kstat_meta),
META_INI_SUB(old_stat,struct mars_dent, mars_kstat_meta),
META_INI(new_link, struct mars_dent, FIELD_STRING),

View File

@ -71,8 +71,10 @@ int mars_send_dent_list(struct mars_socket *sock, struct list_head *anchor)
struct list_head *tmp;
struct mars_dent *dent;
int status = 0;
for (tmp = anchor->next; tmp != anchor; tmp = tmp->next) {
dent = container_of(tmp, struct mars_dent, dent_link);
dent->d_proto = MARS_PROTO_LEVEL;
status = mars_send_struct(sock, dent, mars_dent_meta, true);
if (status < 0)
break;
@ -104,6 +106,10 @@ int mars_recv_dent_list(struct mars_socket *sock, struct list_head *anchor)
mars_free_dent(NULL, dent);
goto done;
}
if (dent->d_proto >= 2) {
sock->s_remote_proto_level = dent->d_proto;
sock->s_common_proto_level = min(dent->d_proto, MARS_PROTO_LEVEL);
}
list_add_tail(&dent->dent_link, anchor);
}
done: