while (true) { var conn = try srv.accept(); while (kids.len >= kids.items.len) { if (cfg.verbose) warn("waiting for kid to die\n", .{}); const pid = waitpid(-1, 0); if (cfg.verbose) warn("wait returned: {}\n", .{pid}); try kids.del(pid); } var pid = try os.fork(); switch (pid) { 0 => { var sc: c.br_ssl_server_context = undefined; //c.br_ssl_server_init_full_ec(&sc, certs, certs_len, c.BR_KEYTYPE_EC, &sk.key.ec); c.br_ssl_server_init_minf2c(&sc, certs, certs_len, &sk.key.ec); var iobuf: [c.BR_SSL_BUFSIZE_BIDI]u8 = undefined; c.br_ssl_engine_set_buffer(&sc.eng, &iobuf, iobuf.len, 1); // * Reset the server context, for a new handshake. if (c.br_ssl_server_reset(&sc) == 0) { return convertError(c.br_ssl_engine_last_error(&sc.eng)); } var s = initStream(&sc.eng, &conn.file, &conn.file); try handler(&cfg, &s); }, else => { try kids.add(pid); conn.file.close(); }, } }