In/out reference counting.

This commit is contained in:
Ian Gulliver
2016-02-25 16:17:25 -08:00
parent aa940137c1
commit 5e604f0596
9 changed files with 35 additions and 12 deletions

View File

@@ -64,6 +64,7 @@ struct serializer {
static void send_del(struct send *send) {
fprintf(stderr, "S %s (%s): Connection closed\n", send->id, send->serializer->name);
peer_count_out--;
peer_epoll_del((struct peer *) send);
assert(!close(send->peer.fd));
if (send->prev) {
@@ -116,6 +117,8 @@ struct serializer *send_get_serializer(char *name) {
}
void send_new(int fd, struct serializer *serializer, struct peer *on_close) {
peer_count_out++;
struct send *send = malloc(sizeof(*send));
assert(send);