[Icecast-dev] Setting explicitly the source of slaves connections

Gilles PIETRI gilou at frequence3.fr
Tue May 15 22:53:24 PDT 2007


As I wanted my slaves to connect to their master using a specific IP
address when they have more than one, though I had to modify a few
things regarding net/sock.c:

I mainly took the code from sock_get_server_socket and removed the
reference to the port setting, in order to modify sock_connect_wto.

Then I changed a few things to not care too much about not being given a
source hostname (falling back to an INET_ANY or whatever connect uses
while not being bound to a specific IP).

The "problem" is that the sock_connect_wto must now be given another
parameter, the source hostname sock_t sock_connect_wto(const char
*source, const char *hostname, int port, int timeout).

It's only called in slave.c, where I just made the call to get_config()
a little earlier, and I send config->hostname as the source. This would
probably have to be documented, or changed to another parameter in the
config, though I didn't care that much, and didn't want to add a
parameter myself to the configuration.

I also changed the macro definition of sock_connect so as to send a
NULL source if sock_connect(h,p) is used, but it is not afaik (legacy code?).

This needs improvement, because I didn't change the code for the
function when HAVE_GETADDRINFO is not defined, as it would probably
lead (me, you? ;)) to also take care of the HAVE_GETHOSTBYNAME thing.


Responsable technique Fréquence3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: source.diff
Type: text/x-patch
Size: 4139 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/icecast-dev/attachments/20070516/8f384340/source.bin

More information about the Icecast-dev mailing list