~ Once we've got a connection in, we set it up here (whether it's via the * websocket proxy, or direct). */
| 546 | /*~ Once we've got a connection in, we set it up here (whether it's via the |
| 547 | * websocket proxy, or direct). */ |
| 548 | static struct io_plan *conn_in(struct io_conn *conn, |
| 549 | struct conn_in *conn_in_arg) |
| 550 | { |
| 551 | struct daemon *daemon = conn_in_arg->daemon; |
| 552 | struct oneshot *timeout; |
| 553 | |
| 554 | /* If they don't complete handshake in reasonable time, we hang up */ |
| 555 | timeout = new_reltimer(&daemon->timers, conn, |
| 556 | time_from_sec(daemon->timeout_secs), |
| 557 | conn_timeout, conn); |
| 558 | |
| 559 | /*~ The crypto handshake differs depending on whether you received or |
| 560 | * initiated the socket connection, so there are two entry points. |
| 561 | * Note, again, the notleak() to avoid our simplistic leak detection |
| 562 | * code from thinking `conn` (which we don't keep a pointer to) is |
| 563 | * leaked */ |
| 564 | return responder_handshake(notleak_with_children(conn), &daemon->mykey, |
| 565 | &conn_in_arg->addr, timeout, |
| 566 | conn_in_arg->is_websocket, |
| 567 | handshake_in_success, daemon); |
| 568 | } |
| 569 | |
| 570 | /* How much is peer worth (when considering disconnect)? */ |
| 571 | static size_t peer_score(struct daemon *daemon, |
no test coverage detected