Comment: | Make it possible to disable sockets. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
590c377d8a61164272a1c2c6270c7041 |
User & Date: | js on 2013-04-26 19:42:52 |
Other Links: | manifest | tags |
2013-04-26
| ||
20:18 | Only build OFProcess if available. check-in: 9965b1550e user: js tags: trunk | |
19:42 | Make it possible to disable sockets. check-in: 590c377d8a user: js tags: trunk | |
2013-04-25
| ||
01:09 | OFSystemInfo: Fix fallback pageSize. check-in: 9c1da35543 user: js tags: trunk | |
Modified configure.ac from [1dac072c32] to [851bfdbc5a].
︙ | ︙ | |||
569 570 571 572 573 574 575 | AC_MSG_CHECKING(for atomic operations) AS_IF([test x"$atomic_ops" != x"none"], [ AC_DEFINE(OF_HAVE_ATOMIC_OPS, 1, [Whether we have atomic operations]) AC_SUBST(ATOMIC_H, "atomic.h") ]) AC_MSG_RESULT($atomic_ops) | < < < < > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | AC_MSG_CHECKING(for atomic operations) AS_IF([test x"$atomic_ops" != x"none"], [ AC_DEFINE(OF_HAVE_ATOMIC_OPS, 1, [Whether we have atomic operations]) AC_SUBST(ATOMIC_H, "atomic.h") ]) AC_MSG_RESULT($atomic_ops) AC_CHECK_FUNC(gmtime_r, [ AC_DEFINE(HAVE_GMTIME_R, 1, [Whether we have gmtime_r]) ]) AC_CHECK_FUNC(localtime_r, [ AC_DEFINE(HAVE_LOCALTIME_R, 1, [Whether we have localtime_r]) ]) AC_ARG_ENABLE(sockets, AS_HELP_STRING([--disable-sockets], [disable socket support])) AS_IF([test x"$enable_sockets" != x"no"], [ AC_DEFINE(OF_HAVE_SOCKETS, 1, [Whether we have sockets]) AC_SUBST(USE_SRCS_SOCKETS, '${SRCS_SOCKETS}') AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket") AC_CHECK_LIB(network, socket, LIBS="$LIBS -lnetwork") AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32") AC_CHECK_FUNC(kqueue, [ AC_DEFINE(HAVE_KQUEUE, 1, [Whether we have kqueue]) AC_SUBST(OFSTREAMOBSERVER_KQUEUE_M, "OFStreamObserver_kqueue.m") ]) AC_CHECK_HEADER(poll.h, [ AC_DEFINE(HAVE_POLL_H, 1, [Whether we have poll.h]) AC_SUBST(OFSTREAMOBSERVER_POLL_M, "OFStreamObserver_poll.m") ]) AC_CHECK_HEADERS(sys/select.h, [ AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Whether we have sys/select.h]) AC_SUBST(OFSTREAMOBSERVER_SELECT_M, "OFStreamObserver_select.m") ]) case "$host_os" in mingw*) AC_SUBST(OFSTREAMOBSERVER_SELECT_M, "OFStreamObserver_select.m") ;; esac AC_MSG_CHECKING(for getaddrinfo) AC_TRY_COMPILE([ #include <stddef.h> #ifndef _WIN32 # include <sys/types.h> # include <sys/socket.h> # include <netdb.h> #else typedef unsigned char BOOL; # include <ws2tcpip.h> #endif ], [ struct addrinfo ai; getaddrinfo(NULL, NULL, NULL, NULL); ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether we have getaddrinfo]) AS_IF([test x"$enable_threads" != x"no"], [ AC_MSG_CHECKING(whether getaddrinfo is thread-safe) case "$host_os" in darwin[[12345]].*) have_threadsafe_getaddrinfo="no" ;; darwin*) have_threadsafe_getaddrinfo="yes" ;; freebsd[[1234]].* | freebsd5.[[1234]]*) have_threadsafe_getaddrinfo="no" ;; freebsd*) have_threadsafe_getaddrinfo="yes" ;; netbsd[[123]].*) have_threadsafe_getaddrinfo="no" ;; netbsd*) have_threadsafe_getaddrinfo="yes" ;; solaris*) have_threadsafe_getaddrinfo="yes" ;; *) have_threadsafe_getaddrinfo="unknown" ;; esac AS_IF([test x"$have_threadsafe_getaddrinfo" = \ x"unknown"], [ AC_EGREP_CPP(yes, [ #ifndef _WIN32 # include <sys/types.h> # include <sys/socket.h> # include <netdb.h> #else # define _WIN32_WINNT 0x0501 # include <windows.h> # include <ws2tcpip.h> #endif #ifdef h_errno yes #end ], [ have_threadsafe_getaddrinfo="yes" ], [ have_threadsafe_getaddrinfo="no" ]) ]) AS_IF([test x"$have_threadsafe_getaddrinfo" = x"yes"], [ AC_DEFINE(HAVE_THREADSAFE_GETADDRINFO, 1, [Whether getaddrinfo is thread-safe]) ]) AC_MSG_RESULT($have_threadsafe_getaddrinfo) ]) ], [ AC_MSG_RESULT(no) ]) ]) AS_IF([test x"$enable_sockets" != x"no" -a x"$enable_threads" != x"no"], [ AC_SUBST(OFHTTPCLIENTTESTS_M, "OFHTTPClientTests.m") ]) AS_IF([test x"$objc_runtime" = x"Apple runtime"], [ AC_CHECK_HEADER(Foundation/NSObject.h, [ AC_SUBST(FOUNDATION_COMPAT_M, "foundation-compat.m") AC_SUBST(BRIDGE, "bridge") |
︙ | ︙ |
Modified extra.mk.in from [ee1481108e] to [48485659ad].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ FORWARDING_S = @FORWARDING_S@ FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@ INSTANCE_M = @INSTANCE_M@ LOOKUP_S = @LOOKUP_S@ OFBLOCKTESTS_M = @OFBLOCKTESTS_M@ OFSTREAMOBSERVER_KQUEUE_M = @OFSTREAMOBSERVER_KQUEUE_M@ OFSTREAMOBSERVER_POLL_M = @OFSTREAMOBSERVER_POLL_M@ OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@ PROPERTIESTESTS_M = @PROPERTIESTESTS_M@ REEXPORT_LIBOBJC = @REEXPORT_LIBOBJC@ RUNTIME = @RUNTIME@ RUNTIME_A = @RUNTIME_A@ RUNTIME_RUNTIME_A = @RUNTIME_RUNTIME_A@ RUNTIME_RUNTIME_LIB_A = @RUNTIME_RUNTIME_LIB_A@ RUNTIME_LIB_A = @RUNTIME_LIB_A@ TESTPLUGIN = @TESTPLUGIN@ TESTS = @TESTS@ TEST_LAUNCHER = @TEST_LAUNCHER@ USE_INCLUDES_THREADS = @USE_INCLUDES_THREADS@ USE_SRCS_PLUGINS = @USE_SRCS_PLUGINS@ USE_SRCS_THREADS = @USE_SRCS_THREADS@ | > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | EXCEPTIONS_EXCEPTIONS_LIB_A = @EXCEPTIONS_EXCEPTIONS_LIB_A@ EXCEPTIONS_LIB_A = @EXCEPTIONS_LIB_A@ FORWARDING_S = @FORWARDING_S@ FOUNDATION_COMPAT_M = @FOUNDATION_COMPAT_M@ INSTANCE_M = @INSTANCE_M@ LOOKUP_S = @LOOKUP_S@ OFBLOCKTESTS_M = @OFBLOCKTESTS_M@ OFHTTPCLIENTTESTS_M = @OFHTTPCLIENTTESTS_M@ OFSTREAMOBSERVER_KQUEUE_M = @OFSTREAMOBSERVER_KQUEUE_M@ OFSTREAMOBSERVER_POLL_M = @OFSTREAMOBSERVER_POLL_M@ OFSTREAMOBSERVER_SELECT_M = @OFSTREAMOBSERVER_SELECT_M@ PROPERTIESTESTS_M = @PROPERTIESTESTS_M@ REEXPORT_LIBOBJC = @REEXPORT_LIBOBJC@ RUNTIME = @RUNTIME@ RUNTIME_A = @RUNTIME_A@ RUNTIME_RUNTIME_A = @RUNTIME_RUNTIME_A@ RUNTIME_RUNTIME_LIB_A = @RUNTIME_RUNTIME_LIB_A@ RUNTIME_LIB_A = @RUNTIME_LIB_A@ TESTPLUGIN = @TESTPLUGIN@ TESTS = @TESTS@ TEST_LAUNCHER = @TEST_LAUNCHER@ USE_INCLUDES_THREADS = @USE_INCLUDES_THREADS@ USE_SRCS_PLUGINS = @USE_SRCS_PLUGINS@ USE_SRCS_SOCKETS = @USE_SRCS_SOCKETS@ USE_SRCS_THREADS = @USE_SRCS_THREADS@ |
Modified src/Makefile from [ba9ed93830] to [8e894e6dc5].
︙ | ︙ | |||
17 18 19 20 21 22 23 | OFDataArray.m \ OFDataArray+BinaryPackValue.m \ OFDataArray+Hashing.m \ OFDate.m \ OFDictionary.m \ OFEnumerator.m \ OFFile.m \ | < < < < < < < > > > > > > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | OFDataArray.m \ OFDataArray+BinaryPackValue.m \ OFDataArray+Hashing.m \ OFDate.m \ OFDictionary.m \ OFEnumerator.m \ OFFile.m \ OFIntrospection.m \ OFList.m \ OFMapTable.m \ OFMD5Hash.m \ OFMutableArray.m \ OFMutableDictionary.m \ OFMutableSet.m \ OFMutableString.m \ OFNull.m \ OFNumber.m \ OFObject.m \ OFObject+Serialization.m \ OFProcess.m \ OFRunLoop.m \ OFSeekableStream.m \ OFSet.m \ OFSHA1Hash.m \ OFSortedList.m \ OFStream.m \ OFString.m \ OFString+Hashing.m \ OFString+JSONValue.m \ OFString+Serialization.m \ OFString+URLEncoding.m \ OFString+XMLEscaping.m \ OFString+XMLUnescaping.m \ OFSystemInfo.m \ OFTimer.m \ OFURL.m \ OFXMLAttribute.m \ OFXMLCDATA.m \ OFXMLCharacters.m \ OFXMLComment.m \ OFXMLElement.m \ OFXMLElement+Serialization.m \ OFXMLElementBuilder.m \ OFXMLNode.m \ OFXMLParser.m \ OFXMLProcessingInstructions.m \ base64.m \ of_asprintf.m \ of_strptime.m \ unicode.m \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} SRCS_PLUGINS = OFPlugin.m SRCS_SOCKETS = OFHTTPClient.m \ OFHTTPRequest.m \ OFHTTPRequestReply.m \ OFHTTPServer.m \ OFStreamObserver.m \ OFStreamSocket.m \ OFTCPSocket.m SRCS_THREADS = OFCondition.m \ OFMutex.m \ OFRecursiveMutex.m \ OFThread.m \ OFThreadPool.m \ OFTLSKey.m |
︙ | ︙ | |||
107 108 109 110 111 112 113 | OFCountedSet_hashtable.m \ OFDictionary_hashtable.m \ OFMutableArray_adjacent.m \ OFMutableDictionary_hashtable.m \ OFMutableSet_hashtable.m \ OFMutableString_UTF8.m \ OFSet_hashtable.m \ | < < < < > > > > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | OFCountedSet_hashtable.m \ OFDictionary_hashtable.m \ OFMutableArray_adjacent.m \ OFMutableDictionary_hashtable.m \ OFMutableSet_hashtable.m \ OFMutableString_UTF8.m \ OFSet_hashtable.m \ OFString_UTF8.m \ ${ASPRINTF_M} \ ${FORWARDING_S} \ ${FOUNDATION_COMPAT_M} \ iso_8859_15.m \ windows_1252.m SRCS_SOCKETS += ${OFSTREAMOBSERVER_KQUEUE_M} \ ${OFSTREAMOBSERVER_POLL_M} \ ${OFSTREAMOBSERVER_SELECT_M} \ OFTCPSocket+SOCKS5.m OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_A} ${RUNTIME_RUNTIME_A} LIB_OBJS_EXTRA = ${EXCEPTIONS_EXCEPTIONS_LIB_A} ${RUNTIME_RUNTIME_LIB_A} include ../buildsys.mk CPPFLAGS += -I. -I.. -Iexceptions -Iruntime LD = ${OBJC} LDFLAGS += ${REEXPORT_LIBOBJC} ${BRIDGE}: ${SHARED_LIB} |
Modified src/OFDataArray.m from [cc46586b15] to [fc3aaeaea9].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #include <string.h> #include <limits.h> #import "OFDataArray.h" #import "OFString.h" #import "OFFile.h" #import "OFURL.h" | > | | | > > | > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #include <string.h> #include <limits.h> #import "OFDataArray.h" #import "OFString.h" #import "OFFile.h" #import "OFURL.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPClient.h" # import "OFHTTPRequest.h" # import "OFHTTPRequestReply.h" #endif #import "OFDictionary.h" #import "OFXMLElement.h" #import "OFSystemInfo.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPRequestFailedException.h" #endif #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedProtocolException.h" #import "autorelease.h" #import "base64.h" #import "macros.h" /* References for static linking */ void _references_to_categories_of_OFDataArray(void) |
︙ | ︙ | |||
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | return self; } - initWithContentsOfURL: (OFURL*)URL { void *pool; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDictionary *headers; OFString *contentLength; Class c; c = [self class]; [self release]; pool = objc_autoreleasePoolPush(); if ([[URL scheme] isEqual: @"file"]) { self = [[c alloc] initWithContentsOfFile: [URL path]]; objc_autoreleasePoolPop(pool); return self; } client = [OFHTTPClient client]; | > > > | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | return self; } - initWithContentsOfURL: (OFURL*)URL { void *pool; #ifdef OF_HAVE_SOCKETS OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDictionary *headers; OFString *contentLength; #endif Class c; c = [self class]; [self release]; pool = objc_autoreleasePoolPush(); #ifdef OF_HAVE_SOCKETS if ([[URL scheme] isEqual: @"file"]) { self = [[c alloc] initWithContentsOfFile: [URL path]]; objc_autoreleasePoolPop(pool); return self; } client = [OFHTTPClient client]; |
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | self = [[reply readDataArrayTillEndOfStream] retain]; headers = [reply headers]; if ((contentLength = [headers objectForKey: @"Content-Length"]) != nil) if ([self count] != (size_t)[contentLength decimalValue]) @throw [OFTruncatedDataException exceptionWithClass: [self class]]; objc_autoreleasePoolPop(pool); return self; } - initWithStringRepresentation: (OFString*)string | > > > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | self = [[reply readDataArrayTillEndOfStream] retain]; headers = [reply headers]; if ((contentLength = [headers objectForKey: @"Content-Length"]) != nil) if ([self count] != (size_t)[contentLength decimalValue]) @throw [OFTruncatedDataException exceptionWithClass: [self class]]; #else @throw [OFUnsupportedProtocolException exceptionWithClass: c]; #endif objc_autoreleasePoolPop(pool); return self; } - initWithStringRepresentation: (OFString*)string |
︙ | ︙ |
Modified src/OFHTTPClient.h from [838f77c97e] to [630572f8e2].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" @class OFHTTPClient; @class OFHTTPRequest; @class OFHTTPRequestReply; @class OFURL; @class OFTCPSocket; @class OFDictionary; | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFHTTPClient; @class OFHTTPRequest; @class OFHTTPRequestReply; @class OFURL; @class OFTCPSocket; @class OFDictionary; |
︙ | ︙ |
Modified src/OFHTTPRequest.h from [f26f1fecd0] to [daf0e520ee].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" @class OFURL; @class OFDictionary; @class OFDataArray; @class OFString; /*! @file */ | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFURL; @class OFDictionary; @class OFDataArray; @class OFString; /*! @file */ |
︙ | ︙ |
Modified src/OFHTTPRequestReply.h from [bdd473d229] to [274b2bd401].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFStream.h" #import "OFHTTPRequest.h" @class OFDictionary; /*! * @brief A class for representing an HTTP request reply as a stream. */ @interface OFHTTPRequestReply: OFStream | > > > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFStream.h" #import "OFHTTPRequest.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFDictionary; /*! * @brief A class for representing an HTTP request reply as a stream. */ @interface OFHTTPRequestReply: OFStream |
︙ | ︙ |
Modified src/OFHTTPServer.h from [ffe70c28fb] to [6142f7e628].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" @class OFHTTPServer; @class OFHTTPRequest; @class OFHTTPRequestReply; @class OFTCPSocket; @class OFException; | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFHTTPServer; @class OFHTTPRequest; @class OFHTTPRequestReply; @class OFTCPSocket; @class OFException; |
︙ | ︙ |
Modified src/OFRunLoop.h from [af319d727b] to [879bd22002].
︙ | ︙ | |||
12 13 14 15 16 17 18 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFStream.h" | > | > > > > | | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFStream.h" #ifdef OF_HAVE_SOCKETS # import "OFTCPSocket.h" #endif @class OFSortedList; #ifdef OF_HAVE_THREADS @class OFMutex; #endif @class OFTimer; @class OFMutableDictionary; @class OFStreamObserver; /*! * @brief A class providing a run loop for the application and its processes. */ @interface OFRunLoop: OFObject { OFSortedList *_timersQueue; #ifdef OF_HAVE_THREADS OFMutex *_timersQueueLock; #endif #ifdef OF_HAVE_SOCKETS OFStreamObserver *_streamObserver; OFMutableDictionary *_readQueues; #endif volatile bool _running; } /*! * @brief Returns the main run loop. * * @return The main run loop */ + (OFRunLoop*)mainRunLoop; /*! * @brief Returns the run loop for the current thread. * * @return The run loop for the current thread */ + (OFRunLoop*)currentRunLoop; + (void)OF_setMainRunLoop: (OFRunLoop*)runLoop; #ifdef OF_HAVE_SOCKETS + (void)OF_addAsyncReadForStream: (OFStream*)stream buffer: (void*)buffer length: (size_t)length target: (id)target selector: (SEL)selector; + (void)OF_addAsyncReadForStream: (OFStream*)stream buffer: (void*)buffer exactLength: (size_t)length target: (id)target selector: (SEL)selector; + (void)OF_addAsyncReadLineForStream: (OFStream*)stream encoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector; + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket target: (id)target selector: (SEL)selector; # ifdef OF_HAVE_BLOCKS + (void)OF_addAsyncReadForStream: (OFStream*)stream buffer: (void*)buffer length: (size_t)length block: (of_stream_async_read_block_t)block; + (void)OF_addAsyncReadForStream: (OFStream*)stream buffer: (void*)buffer exactLength: (size_t)length block: (of_stream_async_read_block_t)block; + (void)OF_addAsyncReadLineForStream: (OFStream*)stream encoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block; + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)socket block: (of_tcpsocket_async_accept_block_t)block; # endif + (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream; #endif /*! * @brief Adds an OFTimer to the run loop. * * @param timer The timer to add */ - (void)addTimer: (OFTimer*)timer; |
︙ | ︙ |
Modified src/OFRunLoop.m from [9ced28ca2c] to [e463b5f0e9].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #include <assert.h> #import "OFRunLoop.h" #import "OFDictionary.h" | > | > > | | | | | | | | | > > > > > > > > > > > | | | | | | | < < < < < < < < < < | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | #include "config.h" #include <assert.h> #import "OFRunLoop.h" #import "OFDictionary.h" #ifdef OF_HAVE_SOCKETS # import "OFStreamObserver.h" #endif #ifdef OF_HAVE_THREADS # import "OFThread.h" # import "OFMutex.h" #endif #import "OFSortedList.h" #import "OFTimer.h" #import "OFDate.h" #import "autorelease.h" #import "macros.h" static OFRunLoop *mainRunLoop = nil; #ifdef OF_HAVE_SOCKETS @interface OFRunLoop_QueueItem: OFObject { @public id _target; SEL _selector; } @end @interface OFRunLoop_ReadQueueItem: OFRunLoop_QueueItem { @public # ifdef OF_HAVE_BLOCKS of_stream_async_read_block_t _block; # endif void *_buffer; size_t _length; } @end @interface OFRunLoop_ExactReadQueueItem: OFRunLoop_QueueItem { @public # ifdef OF_HAVE_BLOCKS of_stream_async_read_block_t _block; # endif void *_buffer; size_t _exactLength, _readLength; } @end @interface OFRunLoop_ReadLineQueueItem: OFRunLoop_QueueItem { @public # ifdef OF_HAVE_BLOCKS of_stream_async_read_line_block_t _block; # endif of_string_encoding_t _encoding; } @end @interface OFRunLoop_AcceptQueueItem: OFRunLoop_QueueItem { @public # ifdef OF_HAVE_BLOCKS of_tcpsocket_async_accept_block_t _block; # endif } @end @implementation OFRunLoop_QueueItem - (void)dealloc { [_target release]; [super dealloc]; } @end @implementation OFRunLoop_ReadQueueItem # ifdef OF_HAVE_BLOCKS - (void)dealloc { [_block release]; [super dealloc]; } # endif @end @implementation OFRunLoop_ExactReadQueueItem # ifdef OF_HAVE_BLOCKS - (void)dealloc { [_block release]; [super dealloc]; } # endif @end @implementation OFRunLoop_ReadLineQueueItem # ifdef OF_HAVE_BLOCKS - (void)dealloc { [_block release]; [super dealloc]; } # endif @end @implementation OFRunLoop_AcceptQueueItem # ifdef OF_HAVE_BLOCKS - (void)dealloc { [_block release]; [super dealloc]; } # endif @end #endif @implementation OFRunLoop + (OFRunLoop*)mainRunLoop { return [[mainRunLoop retain] autorelease]; } |
︙ | ︙ | |||
152 153 154 155 156 157 158 | } + (void)OF_setMainRunLoop: (OFRunLoop*)runLoop { mainRunLoop = [runLoop retain]; } | > | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | } + (void)OF_setMainRunLoop: (OFRunLoop*)runLoop { mainRunLoop = [runLoop retain]; } #ifdef OF_HAVE_SOCKETS # define ADD(type, code) \ void *pool = objc_autoreleasePoolPush(); \ OFRunLoop *runLoop = [self currentRunLoop]; \ OFList *queue = [runLoop->_readQueues objectForKey: stream]; \ type *queueItem; \ \ if (queue == nil) { \ queue = [OFList list]; \ |
︙ | ︙ | |||
223 224 225 226 227 228 229 | { ADD(OFRunLoop_AcceptQueueItem, { queueItem->_target = [target retain]; queueItem->_selector = selector; }) } | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | { ADD(OFRunLoop_AcceptQueueItem, { queueItem->_target = [target retain]; queueItem->_selector = selector; }) } # ifdef OF_HAVE_BLOCKS + (void)OF_addAsyncReadForStream: (OFStream*)stream buffer: (void*)buffer length: (size_t)length block: (of_stream_async_read_block_t)block { ADD(OFRunLoop_ReadQueueItem, { queueItem->_block = [block copy]; |
︙ | ︙ | |||
265 266 267 268 269 270 271 | + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)stream block: (of_tcpsocket_async_accept_block_t)block { ADD(OFRunLoop_AcceptQueueItem, { queueItem->_block = [block copy]; }) } | | < | > > > > > > > > > > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | + (void)OF_addAsyncAcceptForTCPSocket: (OFTCPSocket*)stream block: (of_tcpsocket_async_accept_block_t)block { ADD(OFRunLoop_AcceptQueueItem, { queueItem->_block = [block copy]; }) } # endif # undef ADD + (void)OF_cancelAsyncRequestsForStream: (OFStream*)stream { void *pool = objc_autoreleasePoolPush(); OFRunLoop *runLoop = [self currentRunLoop]; OFList *queue; if ((queue = [runLoop->_readQueues objectForKey: stream]) != nil) { assert([queue count] > 0); [runLoop->_streamObserver removeStreamForReading: stream]; [runLoop->_readQueues removeObjectForKey: stream]; } objc_autoreleasePoolPop(pool); } #endif - init { self = [super init]; @try { _timersQueue = [[OFSortedList alloc] init]; #ifdef OF_HAVE_THREADS _timersQueueLock = [[OFMutex alloc] init]; #endif #ifdef OF_HAVE_SOCKETS _streamObserver = [[OFStreamObserver alloc] init]; [_streamObserver setDelegate: self]; _readQueues = [[OFMutableDictionary alloc] init]; #endif } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_timersQueue release]; #ifdef OF_HAVE_THREADS [_timersQueueLock release]; #endif #ifdef OF_HAVE_SOCKETS [_streamObserver release]; [_readQueues release]; #endif [super dealloc]; } - (void)addTimer: (OFTimer*)timer { #ifdef OF_HAVE_THREADS [_timersQueueLock lock]; @try { #endif [_timersQueue insertObject: timer]; #ifdef OF_HAVE_THREADS } @finally { [_timersQueueLock unlock]; } #endif [timer OF_setInRunLoop: self]; #ifdef OF_HAVE_SOCKETS [_streamObserver cancel]; #endif #if defined(OF_HAVE_THREADS) && !defined(OF_HAVE_SOCKETS) /* FIXME: No way to cancel waiting! What to do? */ #endif } - (void)OF_removeTimer: (OFTimer*)timer { #ifdef OF_HAVE_THREADS [_timersQueueLock lock]; @try { |
︙ | ︙ | |||
359 360 361 362 363 364 365 366 367 368 369 370 371 372 | #ifdef OF_HAVE_THREADS } @finally { [_timersQueueLock unlock]; } #endif } - (void)streamIsReadyForReading: (OFStream*)stream { OFList *queue = [_readQueues objectForKey: stream]; of_list_object_t *listObject; OF_ENSURE(queue != nil); | > | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 | #ifdef OF_HAVE_THREADS } @finally { [_timersQueueLock unlock]; } #endif } #ifdef OF_HAVE_SOCKETS - (void)streamIsReadyForReading: (OFStream*)stream { OFList *queue = [_readQueues objectForKey: stream]; of_list_object_t *listObject; OF_ENSURE(queue != nil); |
︙ | ︙ | |||
382 383 384 385 386 387 388 | length = [stream readIntoBuffer: queueItem->_buffer length: queueItem->_length]; } @catch (OFException *e) { length = 0; exception = e; } | | | | | | | | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | length = [stream readIntoBuffer: queueItem->_buffer length: queueItem->_length]; } @catch (OFException *e) { length = 0; exception = e; } # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { if (!queueItem->_block(stream, queueItem->_buffer, length, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } } else { # endif bool (*func)(id, SEL, OFStream*, void*, size_t, OFException*) = (bool(*)(id, SEL, OFStream*, void*, size_t, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, queueItem->_selector, stream, queueItem->_buffer, length, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } # ifdef OF_HAVE_BLOCKS } # endif } else if ([listObject->object isKindOfClass: [OFRunLoop_ExactReadQueueItem class]]) { OFRunLoop_ExactReadQueueItem *queueItem = listObject->object; size_t length; OFException *exception = nil; @try { length = [stream readIntoBuffer: (char*)queueItem->_buffer + queueItem->_readLength length: queueItem->_exactLength - queueItem->_readLength]; } @catch (OFException *e) { length = 0; exception = e; } queueItem->_readLength += length; if (queueItem->_readLength == queueItem->_exactLength || [stream isAtEndOfStream] || exception != nil) { # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { if (queueItem->_block(stream, queueItem->_buffer, queueItem->_readLength, exception)) queueItem->_readLength = 0; else { [queue removeListObject: listObject]; if ([queue count] == 0) { [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } } else { # endif bool (*func)(id, SEL, OFStream*, void*, size_t, OFException*) = (bool(*)(id, SEL, OFStream*, void*, size_t, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (func(queueItem->_target, |
︙ | ︙ | |||
478 479 480 481 482 483 484 | [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } | | | | | | | | | | | > | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } # ifdef OF_HAVE_BLOCKS } # endif } } else if ([listObject->object isKindOfClass: [OFRunLoop_ReadLineQueueItem class]]) { OFRunLoop_ReadLineQueueItem *queueItem = listObject->object; OFString *line; OFException *exception = nil; @try { line = [stream tryReadLineWithEncoding: queueItem->_encoding]; } @catch (OFException *e) { line = nil; exception = e; } if (line != nil || [stream isAtEndOfStream] || exception != nil) { # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { if (!queueItem->_block(stream, line, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } } else { # endif bool (*func)(id, SEL, OFStream*, OFString*, OFException*) = (bool(*)(id, SEL, OFStream*, OFString*, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, queueItem->_selector, stream, line, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } # ifdef OF_HAVE_BLOCKS } # endif } } else if ([listObject->object isKindOfClass: [OFRunLoop_AcceptQueueItem class]]) { OFRunLoop_AcceptQueueItem *queueItem = listObject->object; OFTCPSocket *newSocket; OFException *exception = nil; @try { newSocket = [(OFTCPSocket*)stream accept]; } @catch (OFException *e) { newSocket = nil; exception = e; } # ifdef OF_HAVE_BLOCKS if (queueItem->_block != NULL) { if (!queueItem->_block((OFTCPSocket*)stream, newSocket, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } } else { # endif bool (*func)(id, SEL, OFTCPSocket*, OFTCPSocket*, OFException*) = (bool(*)(id, SEL, OFTCPSocket*, OFTCPSocket*, OFException*)) [queueItem->_target methodForSelector: queueItem->_selector]; if (!func(queueItem->_target, queueItem->_selector, (OFTCPSocket*)stream, newSocket, exception)) { [queue removeListObject: listObject]; if ([queue count] == 0) { [_streamObserver removeStreamForReading: stream]; [_readQueues removeObjectForKey: stream]; } } # ifdef OF_HAVE_BLOCKS } # endif } else OF_ENSURE(0); } #endif - (void)run { _running = true; for (;;) { void *pool; |
︙ | ︙ | |||
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | #endif /* Watch for stream events until the next timer is due */ if (nextTimer != nil) { double timeout = [nextTimer timeIntervalSinceNow]; if (timeout > 0) [_streamObserver observeWithTimeout: timeout]; } else { /* * No more timers: Just watch for streams until we get * an event. If a timer is added by another thread, it * cancels the observe. */ [_streamObserver observe]; } objc_autoreleasePoolPop(pool); } } - (void)stop { _running = false; #ifdef OF_HAVE_THREADS of_memory_write_barrier(); #endif [_streamObserver cancel]; | > > > > > > > > > > | > > > > | 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | #endif /* Watch for stream events until the next timer is due */ if (nextTimer != nil) { double timeout = [nextTimer timeIntervalSinceNow]; if (timeout > 0) #ifdef OF_HAVE_SOCKETS [_streamObserver observeWithTimeout: timeout]; #else [OFThread sleepForTimeInterval: timeout]; #endif } else { /* * No more timers: Just watch for streams until we get * an event. If a timer is added by another thread, it * cancels the observe. */ #ifdef OF_HAVE_SOCKETS [_streamObserver observe]; #else [OFThread sleepForTimeInterval: 86400]; #endif } objc_autoreleasePoolPop(pool); } } - (void)stop { _running = false; #ifdef OF_HAVE_THREADS of_memory_write_barrier(); #endif #ifdef OF_HAVE_SOCKETS [_streamObserver cancel]; #endif #if defined(OF_HAVE_THREADS) && !defined(OF_HAVE_SOCKETS) /* FIXME: No way to cancel waiting! What to do? */ #endif } @end |
Modified src/OFStream.h from [05795f4687] to [b114d5af52].
︙ | ︙ | |||
28 29 30 31 32 33 34 | /*! @file */ @class OFStream; @class OFDataArray; @class OFException; | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | /*! @file */ @class OFStream; @class OFDataArray; @class OFException; #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_BLOCKS) /*! * @brief A block which is called when data was read from the stream. * * @param stream The stream on which data was read * @param buffer A buffer with the data that has been read * @param length The length of the data that has been read * @param exception An exception which occurred while reading or nil on success |
︙ | ︙ | |||
126 127 128 129 130 131 132 133 134 135 136 137 138 139 | * @param buffer The buffer into which the data is read * @param length The length of the data that should be read. * The buffer *must* be *at least* this big! */ - (void)readIntoBuffer: (void*)buffer exactLength: (size_t)length; /*! * @brief Asyncronously reads *at most* size bytes from the stream into a * buffer. * * On network streams, this might read less than the specified number of bytes. * If you want to read exactly the specified number of bytes, use * @ref asyncReadIntoBuffer:exactLength:block:. Note that a read can even | > | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | * @param buffer The buffer into which the data is read * @param length The length of the data that should be read. * The buffer *must* be *at least* this big! */ - (void)readIntoBuffer: (void*)buffer exactLength: (size_t)length; #ifdef OF_HAVE_SOCKETS /*! * @brief Asyncronously reads *at most* size bytes from the stream into a * buffer. * * On network streams, this might read less than the specified number of bytes. * If you want to read exactly the specified number of bytes, use * @ref asyncReadIntoBuffer:exactLength:block:. Note that a read can even |
︙ | ︙ | |||
182 183 184 185 186 187 188 | * OFException *exception). */ - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length target: (id)target selector: (SEL)selector; | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | * OFException *exception). */ - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length target: (id)target selector: (SEL)selector; # ifdef OF_HAVE_BLOCKS /*! * @brief Asyncronously reads *at most* ref size bytes from the stream into a * buffer. * * On network streams, this might read less than the specified number of bytes. * If you want to read exactly the specified number of bytes, use * @ref asyncReadIntoBuffer:exactLength:block:. Note that a read can even |
︙ | ︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 | * buffer and exact length when more data has been received. If * you want the next block in the queue to handle the data * received next, you need to return false from the block. */ - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length block: (of_stream_async_read_block_t)block; #endif /*! * @brief Reads a uint8_t from the stream. * * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! | > | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | * buffer and exact length when more data has been received. If * you want the next block in the queue to handle the data * received next, you need to return false from the block. */ - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length block: (of_stream_async_read_block_t)block; # endif #endif /*! * @brief Reads a uint8_t from the stream. * * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! |
︙ | ︙ | |||
576 577 578 579 580 581 582 583 584 585 586 587 588 589 | * * @param encoding The encoding used by the stream * @return The line that was read, autoreleased, or nil if the end of the * stream has been reached. */ - (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding; /*! * @brief Asyncronously reads until a newline, \\0, end of stream or an * exception occurs. * * @param target The target on which to call the selector when the data has * been received. If the method returns true, it will be called * again when the next line has been received. If you want the | > | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | * * @param encoding The encoding used by the stream * @return The line that was read, autoreleased, or nil if the end of the * stream has been reached. */ - (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding; #ifdef OF_HAVE_SOCKETS /*! * @brief Asyncronously reads until a newline, \\0, end of stream or an * exception occurs. * * @param target The target on which to call the selector when the data has * been received. If the method returns true, it will be called * again when the next line has been received. If you want the |
︙ | ︙ | |||
610 611 612 613 614 615 616 | * bool (OFStream *stream, OFString *line, * OFException *exception). */ - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector; | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 | * bool (OFStream *stream, OFString *line, * OFException *exception). */ - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector; # ifdef OF_HAVE_BLOCKS /*! * @brief Asyncronously reads until a newline, \\0, end of stream or an * exception occurs. * * @param block The block to call when the data has been received. * If the block returns true, it will be called again when the next * line has been received. If you want the next block in the queue |
︙ | ︙ | |||
636 637 638 639 640 641 642 643 644 645 646 647 648 649 | * If the block returns true, it will be called again when the next * line has been received. If you want the next block in the queue * to handle the next line, you need to return false from the * block. */ - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block; #endif /*! * @brief Tries to read a line from the stream (see readLine) and returns nil if * no complete line has been received yet. * * @return The line that was read, autoreleased, or nil if the line is not | > | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | * If the block returns true, it will be called again when the next * line has been received. If you want the next block in the queue * to handle the next line, you need to return false from the * block. */ - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block; # endif #endif /*! * @brief Tries to read a line from the stream (see readLine) and returns nil if * no complete line has been received yet. * * @return The line that was read, autoreleased, or nil if the line is not |
︙ | ︙ | |||
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | /*! * @brief Returns the file descriptor for the write end of the stream. * * @return The file descriptor for the write end of the stream */ - (int)fileDescriptorForWriting; /*! * @brief Cancels all pending asyncronous requests on the stream. */ - (void)cancelAsyncRequests; /*! * @brief Closes the stream. */ - (void)close; /*! | > > | 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | /*! * @brief Returns the file descriptor for the write end of the stream. * * @return The file descriptor for the write end of the stream */ - (int)fileDescriptorForWriting; #ifdef OF_HAVE_SOCKETS /*! * @brief Cancels all pending asyncronous requests on the stream. */ - (void)cancelAsyncRequests; #endif /*! * @brief Closes the stream. */ - (void)close; /*! |
︙ | ︙ |
Modified src/OFStream.m from [401460f5bb] to [f3e5357ad2].
︙ | ︙ | |||
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | size_t readLength = 0; while (readLength < length) readLength += [self readIntoBuffer: (char*)buffer + readLength length: length - readLength]; } - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer | > | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | size_t readLength = 0; while (readLength < length) readLength += [self readIntoBuffer: (char*)buffer + readLength length: length - readLength]; } #ifdef OF_HAVE_SOCKETS - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer |
︙ | ︙ | |||
168 169 170 171 172 173 174 | [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer exactLength: length target: target selector: selector]; } | | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer exactLength: length target: target selector: selector]; } # ifdef OF_HAVE_BLOCKS - (void)asyncReadIntoBuffer: (void*)buffer length: (size_t)length block: (of_stream_async_read_block_t)block { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer length: length block: block]; } - (void)asyncReadIntoBuffer: (void*)buffer exactLength: (size_t)length block: (of_stream_async_read_block_t)block { [OFRunLoop OF_addAsyncReadForStream: self buffer: buffer exactLength: length block: block]; } # endif #endif - (uint8_t)readInt8 { uint8_t ret; [self readIntoBuffer: (char*)&ret |
︙ | ︙ | |||
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | while ((line = [self tryReadLineWithEncoding: encoding]) == nil) if ([self isAtEndOfStream]) return nil; return line; } - (void)asyncReadLineWithTarget: (id)target selector: (SEL)selector { [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 target: target selector: selector]; } - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadLineForStream: self encoding: encoding target: target selector: selector]; } | > | > | 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | while ((line = [self tryReadLineWithEncoding: encoding]) == nil) if ([self isAtEndOfStream]) return nil; return line; } #ifdef OF_HAVE_SOCKETS - (void)asyncReadLineWithTarget: (id)target selector: (SEL)selector { [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 target: target selector: selector]; } - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding target: (id)target selector: (SEL)selector { [OFRunLoop OF_addAsyncReadLineForStream: self encoding: encoding target: target selector: selector]; } # ifdef OF_HAVE_BLOCKS - (void)asyncReadLineWithBlock: (of_stream_async_read_line_block_t)block { [self asyncReadLineWithEncoding: OF_STRING_ENCODING_UTF_8 block: block]; } - (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding block: (of_stream_async_read_line_block_t)block { [OFRunLoop OF_addAsyncReadLineForStream: self encoding: encoding block: block]; } # endif #endif - (OFString*)tryReadLine { return [self tryReadLineWithEncoding: OF_STRING_ENCODING_UTF_8]; } |
︙ | ︙ | |||
1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | - (int)fileDescriptorForWriting { [self doesNotRecognizeSelector: _cmd]; abort(); } - (void)cancelAsyncRequests { [OFRunLoop OF_cancelAsyncRequestsForStream: self]; } - (void)close { [self doesNotRecognizeSelector: _cmd]; abort(); } - (bool)OF_isWaitingForDelimiter { return _waitingForDelimiter; } @end | > > | 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 | - (int)fileDescriptorForWriting { [self doesNotRecognizeSelector: _cmd]; abort(); } #ifdef OF_HAVE_SOCKETS - (void)cancelAsyncRequests { [OFRunLoop OF_cancelAsyncRequestsForStream: self]; } #endif - (void)close { [self doesNotRecognizeSelector: _cmd]; abort(); } - (bool)OF_isWaitingForDelimiter { return _waitingForDelimiter; } @end |
Modified src/OFStreamObserver.h from [4cd46fa418] to [7fc7495bc7].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #ifdef _WIN32 # include <winsock2.h> #endif @class OFStream; @class OFMutableArray; | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif #ifdef _WIN32 # include <winsock2.h> #endif @class OFStream; @class OFMutableArray; |
︙ | ︙ |
Modified src/OFStreamSocket.h from [9529543da1] to [0eb6c65989].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFStream.h" #ifdef _WIN32 # include <winsock2.h> #endif /*! * @brief A class which provides functions to create and use stream sockets. | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFStream.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif #ifdef _WIN32 # include <winsock2.h> #endif /*! * @brief A class which provides functions to create and use stream sockets. |
︙ | ︙ |
Modified src/OFString.m from [76e87b40ed] to [250db502f2].
︙ | ︙ | |||
24 25 26 27 28 29 30 | #import "OFString.h" #import "OFString_UTF8.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFURL.h" | > | | | > > | > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #import "OFString.h" #import "OFString_UTF8.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFFile.h" #import "OFURL.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPClient.h" # import "OFHTTPRequest.h" # import "OFHTTPRequestReply.h" #endif #import "OFDataArray.h" #import "OFXMLElement.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPRequestFailedException.h" #endif #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedProtocolException.h" #import "autorelease.h" #import "macros.h" #import "of_asprintf.h" #import "unicode.h" /* |
︙ | ︙ | |||
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | encoding: OF_STRING_ENCODING_AUTODETECT]; } - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDictionary *headers; OFString *contentType, *contentLength; OFDataArray *data; Class c; c = [self class]; [self release]; pool = objc_autoreleasePoolPush(); if ([[URL scheme] isEqual: @"file"]) { if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithContentsOfFile: [URL path] encoding: encoding]; objc_autoreleasePoolPop(pool); return self; } client = [OFHTTPClient client]; request = [OFHTTPRequest requestWithURL: URL]; reply = [client performRequest: request]; if ([reply statusCode] != 200) @throw [OFHTTPRequestFailedException exceptionWithClass: [request class] | > > > | 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | encoding: OF_STRING_ENCODING_AUTODETECT]; } - initWithContentsOfURL: (OFURL*)URL encoding: (of_string_encoding_t)encoding { void *pool; #ifdef OF_HAVE_SOCKETS OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDictionary *headers; OFString *contentType, *contentLength; OFDataArray *data; #endif Class c; c = [self class]; [self release]; pool = objc_autoreleasePoolPush(); if ([[URL scheme] isEqual: @"file"]) { if (encoding == OF_STRING_ENCODING_AUTODETECT) encoding = OF_STRING_ENCODING_UTF_8; self = [[c alloc] initWithContentsOfFile: [URL path] encoding: encoding]; objc_autoreleasePoolPop(pool); return self; } #ifdef OF_HAVE_SOCKETS client = [OFHTTPClient client]; request = [OFHTTPRequest requestWithURL: URL]; reply = [client performRequest: request]; if ([reply statusCode] != 200) @throw [OFHTTPRequestFailedException exceptionWithClass: [request class] |
︙ | ︙ | |||
965 966 967 968 969 970 971 972 973 974 975 976 977 978 | if ([data count] != (size_t)[contentLength decimalValue]) @throw [OFTruncatedDataException exceptionWithClass: [self class]]; self = [[c alloc] initWithCString: (char*)[data items] encoding: encoding length: [data count]]; objc_autoreleasePoolPop(pool); return self; } - initWithSerialization: (OFXMLElement*)element | > > > | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 | if ([data count] != (size_t)[contentLength decimalValue]) @throw [OFTruncatedDataException exceptionWithClass: [self class]]; self = [[c alloc] initWithCString: (char*)[data items] encoding: encoding length: [data count]]; #else @throw [OFUnsupportedProtocolException exceptionWithClass: c]; #endif objc_autoreleasePoolPop(pool); return self; } - initWithSerialization: (OFXMLElement*)element |
︙ | ︙ |
Modified src/ObjFW.h from [409806974f] to [fbd2428681].
︙ | ︙ | |||
42 43 44 45 46 47 48 | #import "OFNumber.h" #import "OFDate.h" #import "OFURL.h" #import "OFStream.h" #import "OFFile.h" | > | | | < | | | | | > > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #import "OFNumber.h" #import "OFDate.h" #import "OFURL.h" #import "OFStream.h" #import "OFFile.h" #ifdef OF_HAVE_SOCKETS # import "OFStreamSocket.h" # import "OFTCPSocket.h" # import "OFTLSSocket.h" # import "OFStreamObserver.h" # import "OFHTTPRequest.h" # import "OFHTTPRequestReply.h" # import "OFHTTPClient.h" # import "OFHTTPServer.h" #endif #import "OFProcess.h" #import "OFHash.h" #import "OFMD5Hash.h" #import "OFSHA1Hash.h" #import "OFXMLAttribute.h" #import "OFXMLElement.h" |
︙ | ︙ | |||
76 77 78 79 80 81 82 | #import "OFApplication.h" #import "OFSystemInfo.h" #import "OFTimer.h" #import "OFRunLoop.h" #import "OFAllocFailedException.h" #import "OFException.h" | > | | | | > > | > > | > > | > > | > | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | #import "OFApplication.h" #import "OFSystemInfo.h" #import "OFTimer.h" #import "OFRunLoop.h" #import "OFAllocFailedException.h" #import "OFException.h" #ifdef OF_HAVE_SOCKETS # import "OFAcceptFailedException.h" # import "OFAddressTranslationFailedException.h" # import "OFAlreadyConnectedException.h" # import "OFBindFailedException.h" #endif #import "OFChangeDirectoryFailedException.h" #import "OFChangeFileModeFailedException.h" #import "OFChangeFileOwnerFailedException.h" #ifdef OF_HAVE_THREADS # import "OFConditionBroadcastFailedException.h" # import "OFConditionSignalFailedException.h" # import "OFConditionStillWaitingException.h" # import "OFConditionWaitFailedException.h" #endif #ifdef OF_HAVE_SOCKETS # import "OFConnectionFailedException.h" #endif #import "OFCopyFileFailedException.h" #import "OFCreateDirectoryFailedException.h" #import "OFDeleteDirectoryFailedException.h" #import "OFDeleteFileFailedException.h" #import "OFEnumerationMutationException.h" #import "OFHashAlreadyCalculatedException.h" #ifdef OF_HAVE_SOCKETS # import "OFHTTPRequestFailedException.h" #endif #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" #import "OFInvalidFormatException.h" #import "OFInvalidJSONException.h" #import "OFInvalidServerReplyException.h" #import "OFLinkFailedException.h" #ifdef OF_HAVE_SOCKETS # import "OFListenFailedException.h" #endif #import "OFLockFailedException.h" #import "OFMalformedXMLException.h" #import "OFMemoryNotPartOfObjectException.h" #ifdef OF_HAVE_SOCKETS # import "OFNotConnectedException.h" #endif #import "OFNotImplementedException.h" #import "OFOpenFileFailedException.h" #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "OFReadFailedException.h" #import "OFReadOrWriteFailedException.h" #import "OFRenameFileFailedException.h" |
︙ | ︙ |
Modified src/exceptions/Makefile from [08074185ef] to [556668b48e].
1 2 3 4 5 | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} | < < | < < < < < < > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | include ../../extra.mk STATIC_PIC_LIB_NOINST = ${EXCEPTIONS_LIB_A} STATIC_LIB_NOINST = ${EXCEPTIONS_A} SRCS = OFAllocFailedException.m \ OFChangeDirectoryFailedException.m \ OFChangeFileModeFailedException.m \ OFChangeFileOwnerFailedException.m \ OFCopyFileFailedException.m \ OFCreateDirectoryFailedException.m \ OFDeleteDirectoryFailedException.m \ OFDeleteFileFailedException.m \ OFEnumerationMutationException.m \ OFException.m \ OFHashAlreadyCalculatedException.m \ OFInitializationFailedException.m \ OFInvalidArgumentException.m \ OFInvalidEncodingException.m \ OFInvalidFormatException.m \ OFInvalidJSONException.m \ OFInvalidServerReplyException.m \ OFLinkFailedException.m \ OFLockFailedException.m \ OFMalformedXMLException.m \ OFMemoryNotPartOfObjectException.m \ OFNotImplementedException.m \ OFOpenFileFailedException.m \ OFOutOfMemoryException.m \ OFOutOfRangeException.m \ OFReadFailedException.m \ OFReadOrWriteFailedException.m \ OFRenameFileFailedException.m \ OFSeekFailedException.m \ OFSetOptionFailedException.m \ OFStillLockedException.m \ OFSymlinkFailedException.m \ OFTruncatedDataException.m \ OFUnboundNamespaceException.m \ OFUnlockFailedException.m \ OFUnsupportedProtocolException.m \ OFUnsupportedVersionException.m \ OFWriteFailedException.m \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} SRCS_SOCKETS = OFAcceptFailedException.m \ OFAddressTranslationFailedException.m \ OFAlreadyConnectedException.m \ OFBindFailedException.m \ OFConnectionFailedException.m \ OFHTTPRequestFailedException.m \ OFListenFailedException.m \ OFNotConnectedException.m SRCS_THREADS = OFConditionBroadcastFailedException.m \ OFConditionSignalFailedException.m \ OFConditionStillWaitingException.m \ OFConditionWaitFailedException.m \ OFThreadJoinFailedException.m \ OFThreadStartFailedException.m \ OFThreadStillRunningException.m |
︙ | ︙ |
Modified src/exceptions/OFAcceptFailedException.h from [f828728a28] to [ede346dfd9].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFTCPSocket; /*! * @brief An exception indicating that accepting a connection failed. */ @interface OFAcceptFailedException: OFException | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFTCPSocket; /*! * @brief An exception indicating that accepting a connection failed. */ @interface OFAcceptFailedException: OFException |
︙ | ︙ |
Modified src/exceptions/OFAddressTranslationFailedException.h from [9eb5a36411] to [1027254cc2].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFTCPSocket; /*! * @brief An exception indicating the translation of an address failed. */ @interface OFAddressTranslationFailedException: OFException | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFTCPSocket; /*! * @brief An exception indicating the translation of an address failed. */ @interface OFAddressTranslationFailedException: OFException |
︙ | ︙ |
Modified src/exceptions/OFAlreadyConnectedException.h from [5e96c85485] to [a1bbdc5954].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFTCPSocket; /*! * @brief An exception indicating an attempt to connect or bind an already * connected or bound socket. */ | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFTCPSocket; /*! * @brief An exception indicating an attempt to connect or bind an already * connected or bound socket. */ |
︙ | ︙ |
Modified src/exceptions/OFBindFailedException.h from [3324f93c42] to [08e07c93e0].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFTCPSocket; /*! * @brief An exception indicating that binding a socket failed. */ @interface OFBindFailedException: OFException | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFTCPSocket; /*! * @brief An exception indicating that binding a socket failed. */ @interface OFBindFailedException: OFException |
︙ | ︙ |
Modified src/exceptions/OFConnectionFailedException.h from [6e0a8c3716] to [7bbe937501].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFTCPSocket; /*! * @brief An exception indicating that a connection could not be established. */ @interface OFConnectionFailedException: OFException | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFTCPSocket; /*! * @brief An exception indicating that a connection could not be established. */ @interface OFConnectionFailedException: OFException |
︙ | ︙ |
Modified src/exceptions/OFHTTPRequestFailedException.h from [e63622a3c6] to [ca95dac731].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFHTTPRequest; @class OFHTTPRequestReply; /*! * @brief An exception indicating that a HTTP request failed. */ | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFHTTPRequest; @class OFHTTPRequestReply; /*! * @brief An exception indicating that a HTTP request failed. */ |
︙ | ︙ |
Modified src/exceptions/OFListenFailedException.h from [9a332b8a67] to [1610493659].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFTCPSocket; /*! * @brief An exception indicating that listening on the socket failed. */ @interface OFListenFailedException: OFException | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFTCPSocket; /*! * @brief An exception indicating that listening on the socket failed. */ @interface OFListenFailedException: OFException |
︙ | ︙ |
Modified src/exceptions/OFNotConnectedException.h from [281c34dc5e] to [78d1f92282].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" @class OFStreamSocket; /*! * @brief An exception indicating a socket is not connected or bound. */ @interface OFNotConnectedException: OFException | > > > > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif @class OFStreamSocket; /*! * @brief An exception indicating a socket is not connected or bound. */ @interface OFNotConnectedException: OFException |
︙ | ︙ |
Modified src/exceptions/OFReadOrWriteFailedException.m from [74aee00696] to [a5ac8c3823].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include "config.h" #include <stdlib.h> #import "OFReadOrWriteFailedException.h" #import "OFString.h" | > | > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include "config.h" #include <stdlib.h> #import "OFReadOrWriteFailedException.h" #import "OFString.h" #ifdef OF_HAVE_SOCKETS # import "OFStreamSocket.h" #endif #import "common.h" @implementation OFReadOrWriteFailedException + (instancetype)exceptionWithClass: (Class)class stream: (OFStream*)stream requestedLength: (size_t)requestedLength |
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | requestedLength: (size_t)requestedLength { self = [super initWithClass: class]; _stream = [stream retain]; _requestedLength = requestedLength; if ([class isSubclassOfClass: [OFStreamSocket class]]) _errNo = GET_SOCK_ERRNO; else _errNo = GET_ERRNO; return self; } - (void)dealloc { | > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | requestedLength: (size_t)requestedLength { self = [super initWithClass: class]; _stream = [stream retain]; _requestedLength = requestedLength; #ifdef OF_HAVE_SOCKETS if ([class isSubclassOfClass: [OFStreamSocket class]]) _errNo = GET_SOCK_ERRNO; else #endif _errNo = GET_ERRNO; return self; } - (void)dealloc { |
︙ | ︙ |
Modified src/exceptions/common.h from [258ae8e83b] to [19aae6e6f7].
︙ | ︙ | |||
15 16 17 18 19 20 21 | */ #include <string.h> #import "macros.h" #ifndef _WIN32 | | > | | | | | > | | > | | | | > | > | | > | | > | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | */ #include <string.h> #import "macros.h" #ifndef _WIN32 # if defined(OF_HAVE_SOCKETS) && !defined(HAVE_THREADSAFE_GETADDRINFO) # include <netdb.h> # endif # include <errno.h> # define GET_ERRNO errno # ifdef OF_HAVE_SOCKETS # ifndef HAVE_THREADSAFE_GETADDRINFO # define GET_AT_ERRNO h_errno # else # define GET_AT_ERRNO errno # endif # define GET_SOCK_ERRNO errno # endif # define ERRFMT "Error string was: %s" # define ERRPARAM strerror(_errNo) # ifdef OF_HAVE_SOCKETS # ifndef HAVE_THREADSAFE_GETADDRINFO # define AT_ERRPARAM hstrerror(_errNo) # else # define AT_ERRPARAM strerror(_errNo) # endif # endif #else # include <windows.h> # define GET_ERRNO GetLastError() # ifdef OF_HAVE_SOCKETS # define GET_AT_ERRNO WSAGetLastError() # define GET_SOCK_ERRNO WSAGetLastError() # endif # define ERRFMT "Error code was: %d" # define ERRPARAM _errNo # ifdef OF_HAVE_SOCKETS # define AT_ERRPARAM _errNo # endif #endif |
Modified src/objfw-defs.h.in from [f518fd1de0] to [63a737d4f3].
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 | #undef OF_HAVE_OSATOMIC #undef OF_HAVE_OSATOMIC_64 #undef OF_HAVE_PTHREADS #undef OF_HAVE_PLUGINS #undef OF_HAVE_PTHREAD_SPINLOCKS #undef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES #undef OF_HAVE_SCHED_YIELD #undef OF_HAVE_THREADS #undef OF_OBJFW_RUNTIME #undef SIZE_MAX | > | 9 10 11 12 13 14 15 16 17 18 19 | #undef OF_HAVE_OSATOMIC #undef OF_HAVE_OSATOMIC_64 #undef OF_HAVE_PTHREADS #undef OF_HAVE_PLUGINS #undef OF_HAVE_PTHREAD_SPINLOCKS #undef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES #undef OF_HAVE_SCHED_YIELD #undef OF_HAVE_SOCKETS #undef OF_HAVE_THREADS #undef OF_OBJFW_RUNTIME #undef SIZE_MAX |
Modified tests/Makefile from [9b8d4ab488] to [6d4f7847a4].
︙ | ︙ | |||
15 16 17 18 19 20 21 | OFNumberTests.m \ OFObjectTests.m \ OFSerializationTests.m \ OFSet.m \ OFSHA1HashTests.m \ OFStreamTests.m \ OFStringTests.m \ | < > | > > | < | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | OFNumberTests.m \ OFObjectTests.m \ OFSerializationTests.m \ OFSet.m \ OFSHA1HashTests.m \ OFStreamTests.m \ OFStringTests.m \ OFURLTests.m \ OFXMLElementBuilderTests.m \ OFXMLNodeTests.m \ OFXMLParserTests.m \ ${PROPERTIESTESTS_M} \ TestsAppDelegate.m \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_THREADS} \ ${OFHTTPCLIENTTESTS_M} SRCS_PLUGINS = OFPluginTests.m SRCS_SOCKETS = OFTCPSocketTests.m SRCS_THREADS = OFThreadTests.m IOS_USER ?= mobile IOS_TMP ?= /tmp/objfw-test .PHONY: run run-tests run-on-ios run: all if [ -z "${DONT_RUN_TESTS}" ]; then ${MAKE} ${MFLAGS} run-tests; fi |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [d190941fab] to [f5a2a05389].
︙ | ︙ | |||
137 138 139 140 141 142 143 144 145 146 147 148 | [self arrayTests]; [self dictionaryTests]; [self listTests]; [self setTests]; [self dateTests]; [self numberTests]; [self streamTests]; [self TCPSocketTests]; #ifdef OF_HAVE_THREADS [self threadTests]; #endif [self URLTests]; | > > | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | [self arrayTests]; [self dictionaryTests]; [self listTests]; [self setTests]; [self dateTests]; [self numberTests]; [self streamTests]; #ifdef OF_HAVE_SOCKETS [self TCPSocketTests]; #endif #ifdef OF_HAVE_THREADS [self threadTests]; #endif [self URLTests]; #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS) [self HTTPClientTests]; #endif [self XMLParserTests]; [self XMLNodeTests]; [self XMLElementBuilderTests]; [self serializationTests]; [self JSONTests]; |
︙ | ︙ |