Overview
Comment: | OFStream: writeBufferEnabled -> writeBuffered |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
afb42d363d88dc00728ca7d6941da7a5 |
User & Date: | js on 2015-01-19 22:29:17 |
Other Links: | manifest | tags |
Context
2015-01-19
| ||
22:44 | OFKernelEventObserver_select: Check range of fd check-in: 3cd42fa72d user: js tags: trunk | |
22:29 | OFStream: writeBufferEnabled -> writeBuffered check-in: afb42d363d user: js tags: trunk | |
2015-01-17
| ||
22:41 | Use 64 bit file offsets check-in: c409a0ec95 user: js tags: trunk | |
Changes
Modified src/OFStream.h from [89a2ac053e] to [b3138c427b].
︙ | ︙ | |||
87 88 89 90 91 92 93 | OFCopying> { #if !defined(OF_SEEKABLE_STREAM_M) && !defined(OF_TCP_SOCKET_M) @private #endif char *_readBuffer, *_writeBuffer; size_t _readBufferLength, _writeBufferLength; | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | OFCopying> { #if !defined(OF_SEEKABLE_STREAM_M) && !defined(OF_TCP_SOCKET_M) @private #endif char *_readBuffer, *_writeBuffer; size_t _readBufferLength, _writeBufferLength; bool _writeBuffered, _waitingForDelimiter; @protected bool _blocking; } #ifdef OF_HAVE_PROPERTIES @property (getter=isWriteBuffered) bool writeBuffered; @property (getter=isBlocking) bool blocking; @property (readonly, getter=isAtEndOfStream) bool atEndOfStream; #endif /*! * @brief Returns a boolean whether the end of the stream has been reached. * |
︙ | ︙ | |||
751 752 753 754 755 756 757 | encoding: (of_string_encoding_t)encoding; /*! * @brief Returns a boolen whether writes are buffered. * * @return A boolean whether writes are buffered */ | | | | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | encoding: (of_string_encoding_t)encoding; /*! * @brief Returns a boolen whether writes are buffered. * * @return A boolean whether writes are buffered */ - (bool)isWriteBuffered; /*! * @brief Enables or disables the write buffer. * * @param enable Whether the write buffer should be enabled or disabled */ - (void)setWriteBuffered: (bool)enable; /*! * @brief Writes everythig in the write buffer to the stream. */ - (void)flushWriteBuffer; /*! |
︙ | ︙ |
Modified src/OFStream.m from [822fced640] to [2daf8ca68b].
︙ | ︙ | |||
944 945 946 947 948 949 950 | - (OFString*)tryReadTillDelimiter: (OFString*)delimiter { return [self tryReadTillDelimiter: delimiter encoding: OF_STRING_ENCODING_UTF_8]; } | | | | | | | 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | - (OFString*)tryReadTillDelimiter: (OFString*)delimiter { return [self tryReadTillDelimiter: delimiter encoding: OF_STRING_ENCODING_UTF_8]; } - (bool)isWriteBuffered { return _writeBuffered; } - (void)setWriteBuffered: (bool)enable { _writeBuffered = enable; } - (void)flushWriteBuffer { if (_writeBuffer == NULL) return; [self lowlevelWriteBuffer: _writeBuffer length: _writeBufferLength]; [self freeMemory: _writeBuffer]; _writeBuffer = NULL; _writeBufferLength = 0; } - (void)writeBuffer: (const void*)buffer length: (size_t)length { if (!_writeBuffered) [self lowlevelWriteBuffer: buffer length: length]; else { _writeBuffer = [self resizeMemory: _writeBuffer size: _writeBufferLength + length]; memcpy(_writeBuffer + _writeBufferLength, buffer, length); _writeBufferLength += length; |
︙ | ︙ |
Modified src/OFTCPSocket+SOCKS5.m from [fce1e56365] to [28f2a3085b].
︙ | ︙ | |||
25 26 27 28 29 30 31 | @implementation OFTCPSocket (SOCKS5) - (void)OF_SOCKS5ConnectToHost: (OFString*)host port: (uint16_t)port { const char request[] = { 5, 1, 0, 3 }; char reply[256]; | | | | | | 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 | @implementation OFTCPSocket (SOCKS5) - (void)OF_SOCKS5ConnectToHost: (OFString*)host port: (uint16_t)port { const char request[] = { 5, 1, 0, 3 }; char reply[256]; bool wasWriteBuffered; /* 5 1 0 -> no authentication */ [self writeBuffer: request length: 3]; [self readIntoBuffer: reply exactLength: 2]; if (reply[0] != 5 || reply[1] != 0) { [self close]; @throw [OFConnectionFailedException exceptionWithHost: host port: port socket: self]; } wasWriteBuffered = [self isWriteBuffered]; [self setWriteBuffered: true]; /* CONNECT request */ [self writeBuffer: request length: 4]; [self writeInt8: [host UTF8StringLength]]; [self writeBuffer: [host UTF8String] length: [host UTF8StringLength]]; [self writeBigEndianInt16: port]; [self flushWriteBuffer]; [self setWriteBuffered: wasWriteBuffered]; [self readIntoBuffer: reply exactLength: 4]; if (reply[0] != 5 || reply[1] != 0 || reply[2] != 0) { [self close]; @throw [OFConnectionFailedException exceptionWithHost: host |
︙ | ︙ |