commit - 8e504ac0a34eec172a4b20582137ed870401835c
commit + ed61de840a1b0c8cd8fb2ab4645122836f037715
blob - b01d5ff0b8f11707a8bd727ebeee19a4a4002018
blob + 2261c99c9de815aca46c97ad624aeb5d9501cd66
--- kamirepl.c
+++ kamirepl.c
static void repl_read(struct bufferevent *, void *);
static void repl_error(struct bufferevent *, short, void *);
static void write_hdr(uint32_t, uint8_t, uint16_t);
+static void write_hdr_auto(uint32_t, uint8_t);
static void write_str(uint16_t, const char *);
static void write_fid(uint32_t);
bufferevent_write(bev, &len, sizeof(len));
bufferevent_write(bev, &type, sizeof(type));
bufferevent_write(bev, &tag, sizeof(tag));
+}
+
+static void
+write_hdr_auto(uint32_t len, uint8_t type)
+{
+ static uint16_t tag = 0;
+
+ if (++tag == NOTAG)
+ ++tag;
+
+ write_hdr(len, type, tag);
}
static void
/* fid[4] afid[4] uname[s] aname[s] */
len = 4 + 4 + sizeof(sl) + sl + sizeof(tl) + tl;
- write_hdr(len, Tattach, 0);
+ write_hdr_auto(len, Tattach);
write_fid(fid);
write_fid(NOFID);
write_str(sl, s);