summaryrefslogtreecommitdiff
path: root/src/anet.c
Commit message (Collapse)AuthorAgeFilesLines
* fix tcp binding when IPv6 is unsupportedoranagra2016-09-091-1/+1
|
* anet.c: new API anetTcpNonBlockBestEffortBindConnect()antirez2015-06-111-3/+21
| | | | | | | | | This performs a best effort source address binding attempt. If it is possible to bind the local address and still have a successful connect(), then this socket is returned. Otherwise the call is retried without source address binding attempt. Related to issues #2609 and #2612.
* anetTcpGenericConnect(), jump to error not end on errorantirez2015-06-111-2/+2
| | | | | | | Two code paths jumped to the "ok, return the socket to the user" code path to handle error conditions. Related to issues #2609 and #2612.
* Update anet.cHuachao Huang2015-05-211-1/+1
|
* Improve networking type correctnessMatt Stancliff2015-01-191-2/+2
| | | | | | | | read() and write() return ssize_t (signed long), not int. For other offsets, we can use the unsigned size_t type instead of a signed offset (since our replication offsets and buffer positions are never negative).
* AnetFormatIP(): renamed, commented, now sticks to IP:port format.antirez2014-12-111-9/+10
| | | | | A few code style changes + consistent format: not nice for humans but better for parsers.
* Add centralized IP/Peer formatting functionsMatt Stancliff2014-12-111-0/+24
| | | | | This stops us from needing to manually check against ":" to add brackets around IPv6 addresses everywhere.
* anet.c: new API anetSendTimeout().antirez2014-10-221-0/+15
|
* anet.c: API to set sockets back to blocking mode.antirez2014-10-171-4/+17
|
* anetPeerToString(): make unix sockets distinguishable.antirez2014-09-181-1/+1
| | | | | | | | Following the CLIENT LIST output format, we prefix the unix socket address with a "/" so that it is different than an IPv4/6 address. This makes parsing simpler. Related to #2010.
* anetPeerToString() refactoring and more explicit checks.antirez2014-09-181-8/+19
| | | | Related to PR #2010.
* Unix domain sockets incorrectly listed as IPv6.Yossi Gottlieb2014-09-181-1/+4
|
* Remove warnings and improve integer sign correctness.antirez2014-08-131-0/+2
|
* cluster: fix node connection memory leakkingsumos2014-08-071-1/+3
| | | | | | | | | Cluster leaks memory while connecting due to missing freeaddrinfo() (Commit modified by @antirez. The freeaddrinfo() call was misplaced so in case of no address was bound, the memory leak was still there). Closes #1801
* No more trailing spaces in Redis source code.antirez2014-06-261-1/+1
|
* While ANET_ERR is -1, check syscall retval for -1 itself.antirez2014-04-241-2/+2
|
* Bind source address for cluster communicationMatt Stancliff2014-03-041-4/+28
| | | | | | | | | | | | | The first address specified as a bind parameter (server.bindaddr[0]) gets used as the source IP for cluster communication. If no bind address is specified by the user, the behavior is unchanged. This patch allows multiple Redis Cluster instances to communicate when running on the same interface of the same host.
* Add support for listen(2) backlog definitionNenad Merdanovic2014-01-311-13/+10
| | | | | | In high RPS environments, the default listen backlog is not sufficient, so giving users the power to configure it is the right approach, especially since it requires only minor modifications to the code.
* anetResolveIP() added to anet.c.antirez2014-01-101-1/+18
| | | | | | | | | The new function is used when we want to normalize an IP address without performing a DNS lookup if the string to resolve is not a valid IP. This is useful every time only IPs are valid inputs or when we want to skip DNS resolution that is slow during runtime operations if we are required to block.
* anetPeerToString / SockName: port can be NULL on errors too.antirez2013-12-251-2/+2
|
* anetTcpGenericConnect() bug introduced in 9d19977 fixed.antirez2013-12-251-3/+3
| | | | | Durign a refactoring I mispelled _port for port. This is one of the reasons I never used _varname myself.
* Remove useless goto from anetTcpGenericConnect().antirez2013-12-251-3/+1
|
* anetTcpGenericConnect() code improved + 1 bug fix.antirez2013-12-251-8/+17
| | | | | | | | Now the socket is closed if anetNonBlock() fails, and in general the code structure makes it harder to introduce this kind of bugs in the future. Reference: pull request #1059.
* anet.c: save some vertical space.antirez2013-07-101-10/+3
|
* anet.c: use SO_REUSEADDR when creating listening sockets.antirez2013-07-101-5/+3
| | | | | It used to be ok, but the socket option was removed when adding IPv6 support.
* IPv6: bind IPv4 and IPv6 interfaces by default.antirez2013-07-091-1/+1
|
* Add anetTcp6Server() function.Geoff Garside2013-07-081-2/+15
| | | | | Refactor the common code from anetTcpServer into internal function which can be used by both anetTcpServer and anetTcp6Server.
* Add static anetV6Only() function.Geoff Garside2013-07-081-0/+10
| | | | | This function sets the IPV6_V6ONLY option to 1 to use separate stack IPv6 sockets.
* Change anetTcpGenericConnect to use AF_UNSPEC.Geoff Garside2013-07-081-1/+1
| | | | | This allows anetTcpGenericConnect to try to connect to AF_INET6 addresses in addition to any resolved AF_INET addresses.
* Update anetPeerToString to handle AF_INET6 addrs.Geoff Garside2013-07-081-6/+20
| | | | | | Change the sockaddr_in to sockaddr_storage which is capable of storing both AF_INET and AF_INET6 sockets. Uses the sockaddr_storage ss_family to correctly return the printable IP address and port.
* Update anetTcpAccept to handle AF_INET6 addresses.Geoff Garside2013-07-081-3/+10
| | | | | | Change the sockaddr_in to sockaddr_storage which is capable of storing both AF_INET and AF_INET6 sockets. Uses the sockaddr_storage ss_family to correctly return the printable IP address and port.
* Update anetResolve to resolve AF_INET6 as well.Geoff Garside2013-07-081-4/+6
| | | | | | | | | | | | | | | Change the getaddrinfo(3) hints family from AF_INET to AF_UNSPEC to allow resolution of IPv6 addresses as well as IPv4 addresses. The function will return the IP address of whichever address family is preferenced by the operating system. Most current operating systems will preference AF_INET6 over AF_INET. Unfortunately without attempting to establish a connection to the remote address we can't know if the host is capable of using the returned IP address. It might be desirable to have anetResolve accept an additional argument specifying the AF_INET/AF_INET6 address the caller would like to receive. Currently though it does not appear as though the anetResolve function is ever used within Redis.
* Use inet_ntop(3) in anet. #apichangeGeoff Garside2013-07-081-6/+6
| | | | | | | | | | Replace inet_ntoa(3) calls with the more future proof inet_ntop(3) function which is capable of handling additional address families. API Change: anetTcpAccept() & anetPeerToString() additional argument additional argument required to specify the length of the character buffer the IP address is written to in order to comply with inet_ntop(3) function semantics.
* Use getaddrinfo(3) in a anetTcpServer.Geoff Garside2013-07-081-13/+27
| | | | | | Change anetTcpServer() function to use getaddrinfo(3) to perform address resolution, socket creation and binding. Resolved addresses are limited to those reachable by the AF_INET address family.
* Use getaddrinfo(3) in anetTcpGenericConnect.Geoff Garside2013-07-081-23/+37
| | | | | | Change anetTcpGenericConnect() function to use getaddrinfo(3) to perform address resolution, socket creation and connection. Resolved addresses are limited to those reachable by the AF_INET family.
* Add anetSetReuseAddr(err, fd) static function.Geoff Garside2013-07-081-3/+14
| | | | | | Extract setting SO_REUSEADDR socket option into separate function so the same code can be more easily used by anetCreateSocket and other functions.
* Use getaddrinfo(3) in anetResolve. #apichangeGeoff Garside2013-07-081-12/+16
| | | | | | | | | | | | Change anetResolve() function to use getaddrinfo(3) to resolve hostnames. Resolved hostnames are limited to those reachable by the AF_INET address family. API Change: anetResolve requires additional argument. additional argument required to specify the length of the character buffer the IP address is written to in order to comply with inet_ntop(3) function semantics. inet_ntop(3) replaces inet_ntoa(3) as it has been designed to be compatible with more address families.
* Revert "anet.c: Allow creation of TCP listening sockets bound to N addresses."antirez2013-07-051-15/+8
| | | | | | | Bind() can't be called multiple times against the same socket, multiple sockets are required to bind multiple interfaces, silly me. This reverts commit bd234d62bbfe9feb735fd6d1cdb8f5ce811f54b4.
* anet.c: Allow creation of TCP listening sockets bound to N addresses.antirez2013-07-041-8/+15
|
* Tcp keep-alive: send three probes before detectin an error.antirez2013-02-081-4/+8
| | | | | Otherwise we end with less reliable connections because it's too easy that a single packet gets lost.
* Add SO_KEEPALIVE support to anet.c.antirez2013-02-081-0/+43
|
* TCP_NODELAY after SYNC: changes to the implementation.antirez2013-02-051-6/+6
|
* Turn off TCP_NODELAY on the slave socket after SYNC.charsyam2013-02-051-2/+12
| | | | | | | | | | | | | | | | | | Further details from @antirez: It was reported by @StopForumSpam on Twitter that the Redis replication link was strangely using multiple TCP packets for multiple commands. This wastes a lot of bandwidth and is due to the TCP_NODELAY option we enable on the socket after accepting a new connection. However the master -> slave channel is a one-way channel since Redis replication is asynchronous, so there is no point in trying to reduce the latency, we should aim to reduce the bandwidth. For this reason this commit introduces the ability to disable the nagle algorithm on the socket after a successful SYNC. This feature is off by default because the delay can be up to 40 milliseconds with normally configured Linux kernels.
* Fixed many typos.guiquanz2013-01-191-2/+2
|
* BSD license added to every C source and header file.antirez2012-11-081-1/+1
|
* First implementation of Redis Sentinel.antirez2012-07-231-0/+15
| | | | | | | | This commit implements the first, beta quality implementation of Redis Sentinel, a distributed monitoring system for Redis with notification and automatic failover capabilities. More info at http://redis.io/topics/sentinel
* added explanation for the magic 511 backlog numberErik Dubbelboer2012-04-111-1/+5
|
* anetPeerToString() automatically populates ip/port with something that may ↵antirez2012-03-071-1/+6
| | | | be provided to the user as output in case of errors.
* Added a config directive for a Unix socket maskNathan Florea2011-10-101-1/+4
| | | | | | | Added a configuration directive to allow a user to specify the permissions to be granted to the Unix socket file. I followed the format Pieter and Salvatore discusses in issue #85 ( https://github.com/antirez/redis/issues/85).
* CLIENT LIST implementedantirez2011-04-211-0/+10
|