Get everyone out of flow's business.

This commit is contained in:
Ian Gulliver
2016-03-02 22:25:56 -08:00
parent e62b84e4e8
commit 2f6db632b2
7 changed files with 35 additions and 33 deletions

View File

@@ -61,9 +61,7 @@ static void outgoing_connect_next(struct outgoing *outgoing) {
assert(outgoing->peer.fd >= 0);
struct buf buf = BUF_INIT, *buf_ptr = &buf;
if (outgoing->flow->get_hello) {
outgoing->flow->get_hello(&buf_ptr, outgoing->passthrough);
}
flow_get_hello(outgoing->flow, &buf_ptr, outgoing->passthrough);
ssize_t result = sendto(outgoing->peer.fd, buf_at(buf_ptr, 0), buf_ptr->length, MSG_FASTOPEN, outgoing->addr->ai_addr, outgoing->addr->ai_addrlen);
outgoing_connect_result(outgoing, result == (ssize_t) buf_ptr->length ? EINPROGRESS : errno);
}
@@ -101,7 +99,7 @@ static void outgoing_connect_result(struct outgoing *outgoing, int result) {
outgoing->peer.event_handler = outgoing_disconnect_handler;
flow_socket_ready(fd, outgoing->flow);
flow_socket_connected(fd, outgoing->flow);
outgoing->flow->new(fd, outgoing->passthrough, (struct peer *) outgoing);
flow_new(fd, outgoing->flow, outgoing->passthrough, (struct peer *) outgoing);
break;
case EINPROGRESS: