- 21 Aug, 2014 33 commits
-
-
Philip Withnall authored
This allows FIN–ACK support to be disabled entirely. This is mostly for testing purposes, since TCP_OPT_FIN_ACK is negotiated when establishing the connection, and is disabled if the other side doesn’t support it. This includes an interoperability test.
-
Philip Withnall authored
As found by tsan.
-
Philip Withnall authored
This means that users of the Nice[Input|Output|IO]Stream API can easily close TCP connections without having to hack around with libnice internals.
-
Philip Withnall authored
-
Philip Withnall authored
This is analogous to the UNIX shutdown() function, allowing either or both sides of a pseudo-TCP connection to be shut down.
-
Philip Withnall authored
The TIME-WAIT timeout is typically 2×MSL (on the order of 60 seconds), which is needed to be able to reject delayed segments from closed conversations. However, the underlying socket layer for pseudo-TCP takes care of channel numbering so that segments don’t end up being sent to closed conversations. Therefore, the TIME-WAIT state can be eliminated (by shortening the timeout). The code for the state is kept around so that the pseudo-TCP implementation matches the TCP specification correctly, which will simplify maintenance.
-
Philip Withnall authored
This explicitly removes all timers and main loop considerations from the pseudo-TCP testing, which considerably simplifies arranging packet swaps and mistimings for testing purposes. This test suite includes a few tests for the FIN–ACK support.
-
Philip Withnall authored
In order to detect cases where the peer closes its connection without an explicit in-band close message (e.g. in protocols such as Telnet where there is none), pseudo-TCP needs to grow support for a shutdown handshake, following the TCP FIN–ACK specification. Arguably it should have had this all along, but Jingle apparently doesn’t need it. This adds support for FIN–ACK to the pseudo-TCP implementation. It is backwards-compatible, only being used if the TCP_OPT_FIN_ACK option is specified in the SYN segment. If enabled, full-duplex closes are supported, and the standard method for notifying a peer of the other end closing its connection (returning 0 from recv()) is used. Also allow rapidly tearing down a connection, discarding unsent and unreceived data, by sending an RST segment. This preserves the ability to do a forced socket closure with pseudo_tcp_socket_close(sock, TRUE). It also permits graceful socket shutdown in the case where the final ACK is lost, and one peer gets stuck in the LAST-ACK state: that peer will eventually re-transmit its FIN segment. The other peer, in the CLOSED state, will respond with a RST segment, and the first peer will then reach CLOSED. References (most useful first): • http://tools.ietf.org/html/rfc793#section-3.5 • http://tools.ietf.org/html/rfc1122#page-87 • http://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux.html • http://tools.ietf.org/html/rfc675 Diagram: • http://en.wikipedia.org/wiki/Transmission_Control_Protocol#mediaviewer/File:TCP_CLOSE.svg
-
Philip Withnall authored
As with send(), pseudo_tcp_socket_send() may return EPIPE if the local side of the connection has been closed using close() or shutdown(). It currently doesn’t, but will do once pseudo-TCP FIN–ACK support has been implemented.
-
Philip Withnall authored
Instead, keep the closed object around. This allows differentiation between the states: TCP support was never initialised; and TCP support was initialised but is now closed.
-
Philip Withnall authored
-
Philip Withnall authored
Both state changes need some follow-up code executed immediately after, which was duplicated in a number of places. Factor that out. This introduces no behavioural changes.
-
Philip Withnall authored
This clarifies the code a little, and does not introduce functional changes.
-
Philip Withnall authored
This removes some hard-coded offsets. It does not introduce any functional changes.
-
Philip Withnall authored
Rather than reconstructing the flag state when sending a segment, just store the flags explicitly. This does not introduce any behavioural changes.
-
Philip Withnall authored
This is needed for the upcoming new test suite for pseudo-TCP. It shouldn’t be used in normal code — only in tests. Ideally, the pseudo-TCP code should originally never have called g_get_monotonic_time() itself, and should have always taken a time parameter from the caller; then it would be more testable. Unfortunately, API guarantees prevent this from being changed now.
-
Philip Withnall authored
This should make debugging a little clearer.
-
Philip Withnall authored
The on-the-wire flags (FIN, RST, ACK, etc.) should be in an enum to clarify the code a little. This introduces no functional changes.
-
Philip Withnall authored
This tidies things up a little. No functional changes.
-
Philip Withnall authored
-
Philip Withnall authored
This ensures UTF-8 output is printed correctly.
-
Philip Withnall authored
This clarifies the log output a little.
-
Philip Withnall authored
-
Philip Withnall authored
When freeing candidates (component_free_socket_sources()), the sockets which back Component.selected_pair.[local|remote] are closed and their addresses destroyed. Component.selected_pair should be cleared as well to allow calling code to condition on (Component.selected_pair == NULL) to see if it’s invalid.
-
Philip Withnall authored
This introduces no functional changes.
-
Philip Withnall authored
This simplifies the code a little. No functional changes.
-
Philip Withnall authored
Previously, an EWOULDBLOCK return value from the low-level socket calls (including PseudoTcpSocket) would be represented by a zero number of bytes (or messages) read by the agent. This conflicts with the use of zero to represent end of stream (EOS) for pseudo-TCP connections, where the sender has indicated that they are not going to send any more bytes. So, now use GError (G_IO_ERROR_WOULD_BLOCK) to represent EWOULDBLOCK, just like the GSocket functions. Zero is reserved exclusively for if: • the number of requested bytes/messages is zero; or • reliable mode is enabled and EOS is reached. This does change the documented behaviour of the NiceAgent send/recv API, but only by allowing a new behaviour (returning zero) rather than by changing an existing one, so it should be OK.
-
Philip Withnall authored
We’re dealing with unsigned bytes here, not chars. This will become important when adding new TcpOptions numbered from 254 downwards.
-
Philip Withnall authored
New convenience API to check if the remote end of a pseudo-TCP socket has been closed (but not necessarily the local end). This is currently a stub implementation, but will be used fully once pseudo-TCP FIN–ACK support lands.
-
Philip Withnall authored
New convenience API to check if the socket is in state TCP_CLOSED.
-
Philip Withnall authored
By validating state changes, we can verify that the implementation conforms to the RFC 793 state machine at runtime. This will become more important when FIN–ACK support is added, adding more states.
-
Olivier Crête authored
-
Olivier Crête authored
This is to use keepalives to check if the connection is still ongoing. If they don't get a reply, then we can assume that the connection has died. This needs to not happen in the case of ICE-TCP.
-
- 18 Aug, 2014 3 commits
-
-
Olivier Crête authored
The signal is only connected when setting an agent, if no agent has been set, there will be no signal.
-
Philip Withnall authored
ssize_t should definitely be signed, not unsigned.
-
Philip Withnall authored
As spotted by B Andrei on the mailing list.
-
- 14 Aug, 2014 1 commit
-
-
Philip Withnall authored
At that point, (len > 0), since there are conditions above handling the (len == 0) and (len < 0) cases, both of which break from the loop. Coverity issue: #29325
-
- 13 Aug, 2014 2 commits
-
-
Youness Alaoui authored
-
Youness Alaoui authored
-
- 12 Aug, 2014 1 commit
-
-
Olivier Crête authored
Otherwise, it claimed it was connected when the component was in the FAILED state, when it should really have gone to connecting.
-