Skip to content

Commit

Permalink
Make ssl sockets buffered. Fixes #4248
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Apr 6, 2017
1 parent eae4193 commit 32e4dd5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/openssl/ssl/socket.cr
Expand Up @@ -68,7 +68,7 @@ abstract class OpenSSL::SSL::Socket
end
end

include IO
include IO::Buffered

# If `#sync_close?` is `true`, closing this socket will
# close the underlying IO.
Expand All @@ -91,7 +91,7 @@ abstract class OpenSSL::SSL::Socket
LibSSL.ssl_free(@ssl)
end

def read(slice : Bytes)
def unbuffered_read(slice : Bytes)
check_open

count = slice.size
Expand All @@ -104,7 +104,7 @@ abstract class OpenSSL::SSL::Socket
end
end

def write(slice : Bytes)
def unbuffered_write(slice : Bytes)
check_open

count = slice.size
Expand All @@ -115,7 +115,7 @@ abstract class OpenSSL::SSL::Socket
nil
end

def flush
def unbuffered_flush
@bio.io.flush
end

Expand All @@ -128,7 +128,7 @@ abstract class OpenSSL::SSL::Socket
end
{% end %}

def close
def unbuffered_close
return if @closed
@closed = true

Expand Down Expand Up @@ -165,4 +165,8 @@ abstract class OpenSSL::SSL::Socket
@bio.io.close if @sync_close
end
end

def unbuffered_rewind
raise IO::Error.new("can't rewind OpenSSL::SSL::Socket::Client")

This comment has been minimized.

Copy link
@Sija

Sija Apr 6, 2017

Contributor

can't -> Can't plz :)

end
end

0 comments on commit 32e4dd5

Please sign in to comment.