End the connection when reading a wrong message length.

This commit is contained in:
Philippe Pittoli 2023-05-15 10:13:01 +02:00
parent 5807ea51bd
commit 9d4f5b3cab

View File

@ -451,8 +451,15 @@ pub const Context = struct {
try self.close(i);
return Event.init(Event.Type.DISCONNECTION, i, fd.fd, null);
},
error.wrongMessageLength => {
log.warn("wrong message length, terminating the connection", .{});
try self.close(i);
return Event.init(Event.Type.DISCONNECTION, i, fd.fd, null);
},
else => {
return err;
log.warn("unmanaged error while reading a message ({})", .{err});
try self.close(i);
return Event.init(Event.Type.ERROR, i, fd.fd, null);
},
};