summaryrefslogtreecommitdiff
path: root/src/network
AgeCommit message (Collapse)Author
2014-07-15Fix IPv6 support (sockaddr size)Florent Le Coz
Since struct sockaddr is too small to contain an IPv6, we use struct sockaddr_in6 instead, and we cast it where needed
2014-06-22Delete the timeout event using the correct socket number, instead of -1Florent Le Coz
Was causing the event to not be removed in case of connection failure, which lead to a dangling timed event named “timeout-1”, which was called later, by some other SocketHandler for which even the socket creation failed (so, its socket is -1), with a pointer to the previous SocketHandler which has disappeared for a long time: segmentation fault etc.
2014-06-19Make the Botan rng, credential_manager etc be staticFlorent Le Coz
This actually makes the session_manager be useful, and saves a few octets of memory for the other ones
2014-06-08Add a TimedEvent to cancel the connection to a server after 5 secondsFlorent Le Coz
2014-06-08Implement TLS support using BotanFlorent Le Coz
For now, it tries two TLS ports and then connects to the non-tls port. In the future we would like the user to be able to configure that. fix #2435
2014-06-05Make the destructor of the SocketHandler class protected non-virtualFlorent Le Coz
2014-05-28On connection in-progress, save the whole addrinfo struct, not just ai_addrFlorent Le Coz
2014-05-27Only close/unmanage the socket if we are connected/connectingFlorent Le Coz
Since the socket is now only created and managed whenever the connection is being established, we only close the socket and if it was created (we use -1 to denote the fact that is not yet created, or has been closed) and we only unmanage the socket if it is effectively managed. fix #2529
2014-05-27Support IPv6 connectionsFlorent Le Coz
fix #2522
2014-05-27SocketHandlers own the poller and add themself into it only when the socket ↵Florent Le Coz
is created We want to call socket() with the parameters provided by getaddrinfo, so we can’t addd the fd into the poller immediately. We need to wait the connection attempt, and then the SocketHandler can call add_socket_handler itself, if the connection succeeds, or is in progress.
2014-05-26If both write and read events are available on a socket, only do the readFlorent Le Coz
Because the read handler may discover that the connection has been closed, and then remove the socket from the poller. It that case it is no longer valid to try to call the write handler (which may try to reconnect, but since that socket is no longer managed, this is not OK).
2014-04-29Add missing std::string_literalsFlorent Le Coz
2014-04-29Use C++14 string_literalsFlorent Le Coz
2014-04-15Call on_connection_failed() when the connection fails to be establishedFlorent Le Coz
2014-04-15Remove a useless debug log lineFlorent Le Coz
2014-03-24Reconnected immediately to the XMPP whenever it closes the connectionFlorent Le Coz
2014-03-24Do not send data if we are connected, send it only once we actually areFlorent Le Coz
2014-03-10Remove useless castFlorent Le Coz
2014-03-03Fix a bus error by not going above an array boundaryFlorent Le Coz
2014-02-28Avoid unnecessary copies by recv()ing data directly into the expat bufferFlorent Le Coz
2014-02-27Use scatter/gather io with sendmsg to avoid concataning strings all the timeFlorent Le Coz
2014-02-26Fix a wrong commentFlorent Le Coz
2014-02-22Consider that the connect() succeded if errno EISCONNFlorent Le Coz
Apparently on some systems, subsquent connect() calls may fail with EISCONN error, to indicate that the connection succeded in the background, instead of returning 0.
2014-02-22Save the addrinfo values for reuse on subsequent connect() callFlorent Le Coz
2014-02-22Connection to servers does not block the process anymoreFlorent Le Coz
2014-02-20Do not receive SIGPIPE when send() is called on a closed socketFlorent Le Coz
The error is handled using the return value
2014-02-19Send unavailable presence to all muc when the IRC server closes the connectionFlorent Le Coz
2014-02-08Enable TCP keepalive on socketsFlorent Le Coz
2014-02-08Add missing logger includeFlorent Le Coz
2014-02-08Use strerror and log_error instead of perrrorFlorent Le Coz
2014-02-08Be verbose about IRC server connection failures, and handle them properlyFlorent Le Coz
2014-01-13Add missing stdexcept includesFlorent Le Coz
2014-01-04Add missing errno.h includesFlorent Le Coz
2014-01-04Do not throw an exception when recv returns and error, just close the socketFlorent Le Coz
2014-01-04Keep a "connected" state in the SocketHandler classFlorent Le Coz
2014-01-04Shutdown cleanly on SIGINTFlorent Le Coz
2013-12-24connect() returns a booleanFlorent Le Coz
2013-12-23Read a variable number of bytes, 4096 by defaultFlorent Le Coz
2013-12-03Use the logger everywhereFlorent Le Coz
2013-11-21Let the user choose the poller to use through cmake POLLER optionFlorent Le Coz
Use ccmake, or cmake -i, or cmake -DPOLLER=EPOLL, for example
2013-11-21Use epollFlorent Le Coz
2013-11-10Add include for perrorFlorent Le Coz
2013-11-03Exit the poller when it handles no connection at allFlorent Le Coz
2013-11-02Move the basic socket implementation into the SocketHandler classFlorent Le Coz
(that is, the read/write/connect/etc) Because this code is actually common for both the IrcClient and XmppComponent class. These two classes have to implement some higher level callbacks (parsing the data provided in the buffers, doing stuff when the connection is done) instead of doing the read/write/connect low level things.
2013-11-02Basic IRC message parsing/sendingFlorent Le Coz
2013-11-02First step of the connection skeletonFlorent Le Coz
Basic connect, socket creating, polling, recving, etc.