Skip to content

Commit

Permalink
bypass crystal formatter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian J. Cardiff committed Sep 18, 2016
1 parent 8cef76b commit c789a1e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/mysql/read_packet.cr
Expand Up @@ -6,12 +6,14 @@ class MySql::ReadPacket
@seq : UInt8

def initialize(@io : IO, @connection : Connection)
header = uninitialized UInt8[4]
io.read_fully(header.to_slice)
@length = @remaining = header[0].to_i + (header[1].to_i << 8) + (header[2].to_i << 16)
@seq = header[3]
rescue IO::EOFError
raise DB::ConnectionLost.new(@connection)
begin
header = uninitialized UInt8[4]
io.read_fully(header.to_slice)
@length = @remaining = header[0].to_i + (header[1].to_i << 8) + (header[2].to_i << 16)
@seq = header[3]
rescue IO::EOFError
raise DB::ConnectionLost.new(@connection)
end
end

def to_s(io)
Expand Down

0 comments on commit c789a1e

Please sign in to comment.