src/socket_stream.c


Log

Author Commit Date CI Message
Andreas Smas 9fe70c9e 2017-01-20T23:14:19 Use SOCK_CLOEXEC when creating sockets
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
Patrick Steinhardt 954e06a8 2017-04-26T12:09:57 socket_stream: continue to next addrinfo on socket creation failure When connecting to a remote via socket stream, we first use getaddrinfo to obtain the possible connection methods followed by creating and connecting the socket. But when creating the socket, we error out as soon as we get an invalid socket instead of trying out other address hints returned by addrinfo. Fix this by continuing on invalid socket instead of returning an error. This fixes connection establishment with musl libc.
Edward Thomson 909d5494 2016-12-29T12:25:15 giterr_set: consistent error messages Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
Carlos Martín Nieto 49ae22ba 2014-12-10T01:38:52 stream: constify the write buffer
Carlos Martín Nieto 1b75c29e 2014-11-02T11:17:01 gitno: remove code which is no longer needed Most of the network-facing facilities have been copied to the socket and openssl streams. No code now uses these functions directly anymore, so we can now remove them.
Carlos Martín Nieto 468d7b11 2014-11-01T15:19:54 Add an OpenSSL IO stream This unfortunately isn't as stackable as could be possible, as it hard-codes the socket stream. This is because the method of using a custom openssl BIO is not clear, and we do not need this for now. We can still bring this in if and as we need it.
Carlos Martín Nieto dd4ff2c9 2014-11-01T12:35:54 Introduce stackable IO streams We currently have gitno for talking over TCP, but this needs to know about both plaintext and OpenSSL connections and the code has gotten somewhat messy with ifdefs determining which version of the function should be called. In order to clean this up and abstract away the details of sending over the different types of streams, we can instead use an interface and stack stream implementations. We may not be able to use the stackability with all streams, but we are definitely be able to use the abstraction which is currently spread between different bits of gitno.