|
@@ -1849,12 +1849,25 @@ connection_handle_listener_read(connection_t *conn, int new_type)
|
|
|
tor_assert(0);
|
|
|
};
|
|
|
|
|
|
+ channel_t *chan = NULL;
|
|
|
+
|
|
|
+ if (new_type == CONN_TYPE_OR) {
|
|
|
+ /* Incoming connections will need a new channel passed to the
|
|
|
+ * channel_tls_listener */
|
|
|
+ tor_assert(TO_OR_CONN(newconn)->chan == NULL);
|
|
|
+
|
|
|
+ chan = channel_tls_handle_incoming(TO_OR_CONN(newconn));
|
|
|
+ channel_listener_queue_incoming(channel_tls_get_listener(), chan);
|
|
|
+ }
|
|
|
+
|
|
|
if (connection_add(newconn) < 0) { /* no space, forget it */
|
|
|
+ channel_close_for_error(chan);
|
|
|
connection_free(newconn);
|
|
|
return 0; /* no need to tear down the parent */
|
|
|
}
|
|
|
|
|
|
if (connection_init_accepted_conn(newconn, TO_LISTENER_CONN(conn)) < 0) {
|
|
|
+ channel_close_for_error(chan);
|
|
|
if (! newconn->marked_for_close)
|
|
|
connection_mark_for_close(newconn);
|
|
|
return 0;
|