Overview
Comment: | OFTCPSocket: Clear read buffer for new connection
This prevents reading old data when closing and reconnecting the socket. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c6a4b0a95fd8f28223936074ae8b1358 |
User & Date: | js on 2014-08-18 10:53:56 |
Other Links: | manifest | tags |
Context
2014-08-21
| ||
19:00 | OFHTTPServer: Don't close the socket manually check-in: b87a5d3b46 user: js tags: trunk | |
2014-08-18
| ||
10:53 | OFTCPSocket: Clear read buffer for new connection check-in: c6a4b0a95f user: js tags: trunk | |
2014-08-17
| ||
10:42 | Remove asprintf.[hm] from Xcode project check-in: 9dd18eddc4 user: js tags: trunk | |
Changes
Modified src/OFStream.h from [ef98567a77] to [58a6fa04a7].
︙ | ︙ | |||
82 83 84 85 86 87 88 | */ @interface OFStream: OFObject < #ifdef OF_HAVE_SOCKETS OFReadyForReadingObserving, OFReadyForWritingObserving, #endif OFCopying> { | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | */ @interface OFStream: OFObject < #ifdef OF_HAVE_SOCKETS OFReadyForReadingObserving, OFReadyForWritingObserving, #endif OFCopying> { #if !defined(OF_SEEKABLE_STREAM_M) && !defined(OF_TCP_SOCKET_M) @private #endif char *_readBuffer, *_writeBuffer; size_t _readBufferLength, _writeBufferLength; bool _writeBufferEnabled, _waitingForDelimiter; @protected bool _blocking; |
︙ | ︙ |
Modified src/OFTCPSocket.m from [dc50295dfd] to [e59925afa4].
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * * 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. */ #define __NO_EXT_QNX #include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> | > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * * 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. */ #define OF_TCP_SOCKET_M #define __NO_EXT_QNX #include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 280 | OFString *destinationHost = host; uint16_t destinationPort = port; of_resolver_result_t **results, **iter; if (_socket != INVALID_SOCKET) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; if (_SOCKS5Host != nil) { /* Connect to the SOCKS5 proxy instead */ host = _SOCKS5Host; port = _SOCKS5Port; } results = of_resolve_host(host, port, SOCK_STREAM); | > > > > > > > | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | OFString *destinationHost = host; uint16_t destinationPort = port; of_resolver_result_t **results, **iter; if (_socket != INVALID_SOCKET) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; _listening = false; /* Make sure to clear the read buffer in case the socket is reused */ [self freeMemory: _readBuffer]; _readBuffer = NULL; _readBufferLength = 0; if (_SOCKS5Host != nil) { /* Connect to the SOCKS5 proxy instead */ host = _SOCKS5Host; port = _SOCKS5Port; } results = of_resolve_host(host, port, SOCK_STREAM); |
︙ | ︙ | |||
511 512 513 514 515 516 517 | return ret; } - (bool)isListening { return _listening; } | < < < < < < < | 520 521 522 523 524 525 526 527 | return ret; } - (bool)isListening { return _listening; } @end |