Skip to content

Commit

Permalink
Fix some typos in comments (#543)
Browse files Browse the repository at this point in the history
Motivation:

I came across a few typos and then went through the entire code base
fixing similar errors when I noticed a pattern.

Modifications:

No changes to the code, just to comments.

Result:

No changes.
  • Loading branch information
ole authored and Lukasa committed Aug 1, 2018
1 parent 81307bd commit c6acf77
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Sources/NIO/BaseSocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class BaseSocket: Selectable {
/// Create a new instance.
///
/// The ownership of the passed in descriptor is transferred to this class. A user must call `close` to close the underlying
/// file descriptor once its not needed / used anymore.
/// file descriptor once it's not needed / used anymore.
///
/// - parameters:
/// - descriptor: The file descriptor to wrap.
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIO/EventLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public struct EventLoopIterator: Sequence, IteratorProtocol {
/// }
/// ```
///
/// Because an `EventLoop` may be shared between multiple `Channel`s its important to _NOT_ block while processing IO / tasks. This also includes long running computations which will have the same
/// Because an `EventLoop` may be shared between multiple `Channel`s it's important to _NOT_ block while processing IO / tasks. This also includes long running computations which will have the same
/// effect as blocking in this case.
public protocol EventLoop: EventLoopGroup {
/// Returns `true` if the current `Thread` is the same as the `Thread` that is tied to this `EventLoop`. `false` otherwise.
Expand Down Expand Up @@ -522,7 +522,7 @@ internal final class SelectableEventLoop: EventLoop {
public func deregister<C: SelectableChannel>(channel: C) throws {
assert(inEventLoop)
guard lifecycleState == .open else {
// Its possible the EventLoop was closed before we were able to call deregister, so just return in this case as there is no harm.
// It's possible the EventLoop was closed before we were able to call deregister, so just return in this case as there is no harm.
return
}
try selector.deregister(selectable: channel.selectable)
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIO/IO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public struct IOError: Swift.Error {
/// - parameters:
/// - errorCode: the `errno` that was set for the operation.
/// - reason: what failed
/// -returns: the constructed reason.
/// - returns: the constructed reason.
private func reasonForError(errnoCode: Int32, reason: String) -> String {
if let errorDescC = strerror(errnoCode) {
let errorDescLen = strlen(errorDescC)
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIO/NonBlockingFileIO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public struct NonBlockingFileIO {
/// Open the file at `path` on a private thread pool which is separate from any `EventLoop` thread.
///
/// This function will return (a future) of the `FileHandle` associated with the file opened and a `FileRegion`
/// comprising of the whole file. The caller must close the returned `FileHandle` when its no longer needed.
/// comprising of the whole file. The caller must close the returned `FileHandle` when it's no longer needed.
///
/// - note: The reason this returns the `FileHandle` and the `FileRegion` is that both the opening of a file as well as the querying of its size are blocking.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIO/RecvByteBufferAllocator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public struct AdaptiveRecvByteBufferAllocator: RecvByteBufferAllocator {
return high
}

// Its import to put (...) around as >> is executed before + in swift while in java its the other way around (doh!)
// It's important to put (...) around as >> is executed before + in Swift while in Java it's the other way around (doh!)
let mid = (low + high) >> 1

let a = sizeTable[mid]
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIO/Selector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ public enum IOEvent {
/// Something is ready to be read.
case read

/// Its possible to write some data again.
/// It's possible to write some data again.
case write

/// Combination of `read` and `write`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIO/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public typealias IOVector = iovec
/// Create a new instance.
///
/// The ownership of the passed in descriptor is transferred to this class. A user must call `close` to close the underlying
/// file descriptor once its not needed / used anymore.
/// file descriptor once it's not needed / used anymore.
///
/// - parameters:
/// - descriptor: The file descriptor to wrap.
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIO/SocketChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ final class ServerSocketChannel: BaseSocketChannel<ServerSocket> {

let p: EventLoopPromise<Void> = eventLoop.newPromise()
p.futureResult.map {
// Its important to call the methods before we actually notify the original promise for ordering reasons.
// It's important to call the methods before we actually notify the original promise for ordering reasons.
self.becomeActive0(promise: promise)
}.whenFailure{ error in
promise?.fail(error: error)
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIO/System.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//===----------------------------------------------------------------------===//
// This file contains code that ensures errno is captured correctly when doing syscalls and no ARC traffic can happen inbetween that *could* change the errno
// value before we were able to read it.
// Its important that all static methods are declared with `@inline(never)` so its not possible any ARC traffic happens while we need to read errno.
// It's important that all static methods are declared with `@inline(never)` so it's not possible any ARC traffic happens while we need to read errno.
//
// Created by Norman Maurer on 11/10/17.
//
Expand Down Expand Up @@ -373,7 +373,7 @@ internal enum Posix {
}
}

// Its not really posix but exists on Linux and MacOS / BSD so just put it here for now to keep it simple
// It's not really posix but exists on Linux and MacOS / BSD so just put it here for now to keep it simple
@inline(never)
public static func sendfile(descriptor: CInt, fd: CInt, offset: off_t, count: size_t) throws -> IOResult<Int> {
var written: off_t = 0
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIO/Thread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final class Thread {
/// Get current name of the `Thread` or `nil` if not set.
var name: String? {
get {
// 64 bytes should be good enough as on linux the limit is usually 16 and its very unlikely a user will ever set something longer anyway.
// 64 bytes should be good enough as on Linux the limit is usually 16 and it's very unlikely a user will ever set something longer anyway.
var chars: [CChar] = Array(repeating: 0, count: 64)
guard sys_pthread_getname_np(pthread, &chars, chars.count) == 0 else {
return nil
Expand All @@ -77,7 +77,7 @@ final class Thread {
/// - name: The name of the `Thread` or `nil` if no specific name should be set.
/// - body: The function to execute within the spawned `Thread`.
static func spawnAndRun(name: String? = nil, body: @escaping (Thread) -> Void) {
// Unfortunately the pthread_create method take a different first argument depending on if its on linux or macOS, so ensure we use the correct one.
// Unfortunately the pthread_create method take a different first argument depending on if it's on Linux or macOS, so ensure we use the correct one.
#if os(Linux)
var pt: pthread_t = pthread_t()
#else
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOChatServer/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ let bootstrap = ServerBootstrap(group: group)
.childChannelInitializer { channel in
// Add handler that will buffer data until a \n is received
channel.pipeline.add(handler: LineDelimiterCodec()).then { v in
// Its important we use the same handler for all accepted channels. The ChatHandler is thread-safe!
// It's important we use the same handler for all accepted channels. The ChatHandler is thread-safe!
channel.pipeline.add(handler: chatHandler)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/NIOEchoClient/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private final class EchoHandler: ChannelInboundHandler {
public func channelActive(ctx: ChannelHandlerContext) {
print("Client connected to \(ctx.remoteAddress!)")

// We are connected its time to send the message to the server to initialize the ping-pong sequence.
// We are connected. It's time to send the message to the server to initialize the ping-pong sequence.
var buffer = ctx.channel.allocator.buffer(capacity: line.utf8.count)
buffer.write(string: line)
self.numBytes = buffer.readableBytes
Expand Down
4 changes: 2 additions & 2 deletions Sources/NIOHTTP1/HTTPDecoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ public class HTTPDecoder<HTTPMessageT>: ByteToMessageDecoder, AnyHTTPDecoder {
assert(self.state.slice == nil)

if self.cumulationBuffer!.readableBytes == 0 {
// Its safe to just drop the cumulationBuffer as we don't have any extra views into it that are represented as readerIndex / length.
// It's safe to just drop the cumulationBuffer as we don't have any extra views into it that are represented as readerIndex / length.
self.cumulationBuffer = nil
}

Expand Down Expand Up @@ -567,7 +567,7 @@ public class HTTPDecoder<HTTPMessageT>: ByteToMessageDecoder, AnyHTTPDecoder {
}
}

/// Will discard bytes till readerIndex if its needed and then call `fn`.
/// Will discard bytes till readerIndex if it's needed and then call `fn`.
private func mayDiscardDecodedBytes(upTo: Int, _ fn: () -> Void) {
assert(self.cumulationBuffer!.readerIndex == self.cumulationBuffer!.writerIndex)
self.cumulationBuffer!.moveReaderIndex(to: upTo)
Expand Down
2 changes: 1 addition & 1 deletion Tests/NIOTests/TestUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ final class NonAcceptingServerSocket: ServerSocket {
private var errors: [Int32]

init(errors: [Int32]) throws {
// Reverse so its cheaper to remove errors.
// Reverse so it's cheaper to remove errors.
self.errors = errors.reversed()
try super.init(protocolFamily: AF_INET, setNonBlocking: true)
}
Expand Down

0 comments on commit c6acf77

Please sign in to comment.