Skip to content

Commit

Permalink
Renamed read(_:bufferSize:) to read(_:size:)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrkhanAlikhanov committed Dec 15, 2017
1 parent 1afc7db commit 826a218
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Sources/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ open class Socket {
return byte
}

open func read(_ buffer: UnsafeMutableRawPointer, bufferSize: Int) throws -> Int {
if let ssl = tls {
return try ssl.read(buffer, size: bufferSize)
open func read(_ buffer: UnsafeMutableRawPointer, size: Int) throws -> Int {
if let tls = tls {
return try tls.read(buffer, size: size)
}
let received = try ing { recv(fileDescriptor, buffer, bufferSize, 0) }
let received = try ing { recv(fileDescriptor, buffer, size, 0) }
return received
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/SocketSwiftTests/SocketSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SocketSwiftTests: XCTestCase {
try! socket.write("GET / HTTP/1.1\r\n\r\n".bytes)
let expected = "HTTP/1.1 "
var buff = [Byte](repeating: 0, count: expected.count)
let read = try! socket.read(&buff, bufferSize: buff.count)
let read = try! socket.read(&buff, size: buff.count)
XCTAssertEqual(read, buff.count)
XCTAssertEqual(String(bytes: buff, encoding: .utf8), expected)
}
Expand Down Expand Up @@ -59,7 +59,7 @@ class SocketSwiftTests: XCTestCase {
writableClient.close()

var buffer = [Byte](repeating: 0, count: 16)
let totalBytesReceived = try! client.read(&buffer, bufferSize: 16)
let totalBytesReceived = try! client.read(&buffer, size: 16)

let results = Array(buffer.prefix(totalBytesReceived))

Expand Down

0 comments on commit 826a218

Please sign in to comment.