~mdw
/
tripe
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
server/peer.c (p_txend): Rework the success path.
[tripe]
/
server
/
peer.c
diff --git
a/server/peer.c
b/server/peer.c
index
dab3bfc
..
0b5a6c2
100644
(file)
--- a/
server/peer.c
+++ b/
server/peer.c
@@
-430,7
+430,7
@@
static void p_read(int fd, unsigned mode, void *v)
if (!p) goto unexp;
p_rxupdstats(p, n);
buf_put(p_txstart(p, MSG_MISC | MISC_PONG), BCUR(&b), BLEFT(&b));
if (!p) goto unexp;
p_rxupdstats(p, n);
buf_put(p_txstart(p, MSG_MISC | MISC_PONG), BCUR(&b), BLEFT(&b));
- p_txend(p);
+ p_txend(p
, 0
);
break;
case MISC_PONG:
if (!p) goto unexp;
break;
case MISC_PONG:
if (!p) goto unexp;
@@
-445,7
+445,7
@@
static void p_read(int fd, unsigned mode, void *v)
buf_flip(&bb);
p_encrypt(p, MSG_MISC | MISC_EPONG, &bb,
p_txstart(p, MSG_MISC | MISC_EPONG));
buf_flip(&bb);
p_encrypt(p, MSG_MISC | MISC_EPONG, &bb,
p_txstart(p, MSG_MISC | MISC_EPONG));
- p_txend(p);
+ p_txend(p
, 0
);
}
break;
case MISC_EPONG:
}
break;
case MISC_EPONG:
@@
-533,6
+533,7
@@
int p_txaddr(const addr *a, const void *p, size_t sz)
/* --- @p_txend@ --- *
*
* Arguments: @peer *p@ = pointer to peer block
/* --- @p_txend@ --- *
*
* Arguments: @peer *p@ = pointer to peer block
+ * @unsigned f@ = flags
*
* Returns: ---
*
*
* Returns: ---
*
@@
-562,11
+563,13
@@
static int p_dotxend(peer *p)
}
}
}
}
-void p_txend(peer *p)
+void p_txend(peer *p
, unsigned f
)
{
{
- if (p_dotxend(p) && p->spec.t_ka) {
- sel_rmtimer(&p->tka);
- p_setkatimer(p);
+ if (p_dotxend(p)) {
+ if (p->spec.t_ka) {
+ sel_rmtimer(&p->tka);
+ p_setkatimer(p);
+ }
}
}
}
}
@@
-656,7
+659,7
@@
int p_pingsend(peer *p, ping *pg, unsigned type,
pg->msg = MISC_PONG;
b = p_txstart(p, MSG_MISC | MISC_PING);
p_pingwrite(pg, b);
pg->msg = MISC_PONG;
b = p_txstart(p, MSG_MISC | MISC_PING);
p_pingwrite(pg, b);
- p_txend(p);
+ p_txend(p
, 0
);
break;
case MISC_EPING:
pg->msg = MISC_EPONG;
break;
case MISC_EPING:
pg->msg = MISC_EPONG;
@@
-667,7
+670,7
@@
int p_pingsend(peer *p, ping *pg, unsigned type,
p_encrypt(p, MSG_MISC | MISC_EPING, &bb, b);
if (!BOK(b))
return (-1);
p_encrypt(p, MSG_MISC | MISC_EPING, &bb, b);
if (!BOK(b))
return (-1);
- p_txend(p);
+ p_txend(p
, 0
);
break;
default:
abort();
break;
default:
abort();
@@
-704,7
+707,7
@@
void p_greet(peer *p, const void *c, size_t sz)
{
buf *b = p_txstart(p, MSG_MISC | MISC_GREET);
buf_put(b, c, sz);
{
buf *b = p_txstart(p, MSG_MISC | MISC_GREET);
buf_put(b, c, sz);
- p_txend(p);
+ p_txend(p
, 0
);
}
/* --- @p_tun@ --- *
}
/* --- @p_tun@ --- *
@@
-726,7
+729,7
@@
void p_tun(peer *p, buf *b)
if (BOK(bb) && BLEN(bb)) {
p->st.n_ipout++;
p->st.sz_ipout += BLEN(bb);
if (BOK(bb) && BLEN(bb)) {
p->st.n_ipout++;
p->st.sz_ipout += BLEN(bb);
- p_txend(p);
+ p_txend(p
, 0
);
}
}
}
}
@@
-1242,7
+1245,7
@@
void p_destroy(peer *p, int bye)
buf_init(&bb, buf_t, sizeof(buf_t));
assert(BOK(&bb)); buf_flip(&bb);
p_encrypt(p, MSG_MISC | MISC_BYE, &bb, b);
buf_init(&bb, buf_t, sizeof(buf_t));
assert(BOK(&bb)); buf_flip(&bb);
p_encrypt(p, MSG_MISC | MISC_BYE, &bb, b);
- p_txend(p);
+ p_txend(p
, 0
);
}
a_notify("KILL", "%s", p->spec.name, A_END);
}
a_notify("KILL", "%s", p->spec.name, A_END);