Skip to content

Commit

Permalink
server: fix closing when the tls handshake fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mookums committed Oct 19, 2024
1 parent 27c4d37 commit b169578
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/core/server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,17 @@ pub fn Server(
log.debug("processing handshake", .{});
handshake_job.count += 1;

if (length < 0 or handshake_job.count >= 50) {
if (length <= 0) {
log.debug("handshake connection closed", .{});
try rt.net.close(.{
.fd = p.socket,
.func = close_task,
.ctx = p,
});
return error.TLSHandshakeClosed;
}

if (handshake_job.count >= 50) {
log.debug("handshake taken too many cycles", .{});
try rt.net.close(.{
.fd = p.socket,
Expand Down

0 comments on commit b169578

Please sign in to comment.