Skip to content

Commit

Permalink
Merge pull request #208 from IBM-Swift/fix_build
Browse files Browse the repository at this point in the history
Fix the build breaks as of late.
  • Loading branch information
quanvo87 committed Jul 18, 2017
2 parents dc135bc + f31e284 commit 03af0ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions Sources/KituraNet/IncomingSocketHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public class IncomingSocketHandler {
/// The `IncomingSocketProcessor` instance that processes data read from the underlying socket.
public var processor: IncomingSocketProcessor?

private weak var manager: IncomingSocketManager?

private let readBuffer = NSMutableData()
private let writeBuffer = NSMutableData()
private var writeBufferPosition = 0
Expand Down Expand Up @@ -84,25 +82,26 @@ public class IncomingSocketHandler {
/// The file descriptor of the incoming socket
var fileDescriptor: Int32 { return socket.socketfd }

init(socket: Socket, using: IncomingSocketProcessor, managedBy: IncomingSocketManager) {
init(socket: Socket, using: IncomingSocketProcessor) {
self.socket = socket
processor = using
manager = managedBy

#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS) || GCD_ASYNCH
socketReaderQueue = IncomingSocketHandler.socketReaderQueues[Int(socket.socketfd) % numberOfSocketReaderQueues]

readerSource = DispatchSource.makeReadSource(fileDescriptor: socket.socketfd,
queue: socketReaderQueue)
#endif

processor?.handler = self

#if os(OSX) || os(iOS) || os(tvOS) || os(watchOS) || GCD_ASYNCH
readerSource.setEventHandler() {
_ = self.handleRead()
}
readerSource.setCancelHandler(handler: self.handleCancel)
readerSource.resume()
#endif

processor?.handler = self
}

/// Read in the available data and hand off to common processing code
Expand Down
4 changes: 2 additions & 2 deletions Sources/KituraNet/IncomingSocketManager.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright IBM Corporation 2016
* Copyright IBM Corporation 2016, 2017
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -117,7 +117,7 @@ public class IncomingSocketManager {
do {
try socket.setBlocking(mode: false)

let handler = IncomingSocketHandler(socket: socket, using: processor, managedBy: self)
let handler = IncomingSocketHandler(socket: socket, using: processor)
socketHandlers[socket.socketfd] = handler

#if !GCD_ASYNCH && os(Linux)
Expand Down

0 comments on commit 03af0ff

Please sign in to comment.