Skip to content

Commit 7207b89

Browse files
authored
Merge pull request #2490 from millenomi/urlsessionstreamtask
2 parents 72d266e + 995ce53 commit 7207b89

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

Foundation/URLSession/URLSession.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ open class URLSession : NSObject {
456456

457457
/* Creates a bidirectional stream task to a given host and port.
458458
*/
459-
open func streamTask(withHostName hostname: String, port: Int) -> URLSessionStreamTask { NSUnimplemented() }
459+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
460+
open func streamTask(withHostName hostname: String, port: Int) -> URLSessionStreamTask { NSUnsupported() }
460461
}
461462

462463

Foundation/URLSession/URLSessionTask.swift

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -668,56 +668,64 @@ open class URLSessionDownloadTask : URLSessionTask {
668668
* disassociated from the underlying session.
669669
*/
670670

671+
@available(*, deprecated, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
671672
open class URLSessionStreamTask : URLSessionTask {
672673

673674
/* Read minBytes, or at most maxBytes bytes and invoke the completion
674675
* handler on the sessions delegate queue with the data or an error.
675676
* If an error occurs, any outstanding reads will also fail, and new
676677
* read requests will error out immediately.
677678
*/
678-
open func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval, completionHandler: @escaping (Data?, Bool, Error?) -> Void) { NSUnimplemented() }
679+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
680+
open func readData(ofMinLength minBytes: Int, maxLength maxBytes: Int, timeout: TimeInterval, completionHandler: @escaping (Data?, Bool, Error?) -> Void) { NSUnsupported() }
679681

680682
/* Write the data completely to the underlying socket. If all the
681683
* bytes have not been written by the timeout, a timeout error will
682684
* occur. Note that invocation of the completion handler does not
683685
* guarantee that the remote side has received all the bytes, only
684686
* that they have been written to the kernel. */
685-
open func write(_ data: Data, timeout: TimeInterval, completionHandler: @escaping (Error?) -> Void) { NSUnimplemented() }
687+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
688+
open func write(_ data: Data, timeout: TimeInterval, completionHandler: @escaping (Error?) -> Void) { NSUnsupported() }
686689

687690
/* -captureStreams completes any already enqueued reads
688691
* and writes, and then invokes the
689692
* URLSession:streamTask:didBecomeInputStream:outputStream: delegate
690693
* message. When that message is received, the task object is
691694
* considered completed and will not receive any more delegate
692695
* messages. */
693-
open func captureStreams() { NSUnimplemented() }
696+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
697+
open func captureStreams() { NSUnsupported() }
694698

695699
/* Enqueue a request to close the write end of the underlying socket.
696700
* All outstanding IO will complete before the write side of the
697701
* socket is closed. The server, however, may continue to write bytes
698702
* back to the client, so best practice is to continue reading from
699703
* the server until you receive EOF.
700704
*/
701-
open func closeWrite() { NSUnimplemented() }
705+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
706+
open func closeWrite() { NSUnsupported() }
702707

703708
/* Enqueue a request to close the read side of the underlying socket.
704709
* All outstanding IO will complete before the read side is closed.
705710
* You may continue writing to the server.
706711
*/
707-
open func closeRead() { NSUnimplemented() }
712+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
713+
open func closeRead() { NSUnsupported() }
708714

709715
/*
710716
* Begin encrypted handshake. The handshake begins after all pending
711717
* IO has completed. TLS authentication callbacks are sent to the
712718
* session's -URLSession:task:didReceiveChallenge:completionHandler:
713719
*/
714-
open func startSecureConnection() { NSUnimplemented() }
720+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
721+
open func startSecureConnection() { NSUnsupported() }
715722

716723
/*
717724
* Cleanly close a secure connection after all pending secure IO has
718725
* completed.
719726
*/
720-
open func stopSecureConnection() { NSUnimplemented() }
727+
@available(*, unavailable, message: "URLSessionStreamTask is not available in swift-corelibs-foundation")
728+
open func stopSecureConnection() { NSUnsupported() }
721729
}
722730

723731
/* Key in the userInfo dictionary of an NSError received during a failed download. */

0 commit comments

Comments
 (0)