Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error message on conflicting ports while using '-l'
Memcached can be started with configurable addresses to listen on, using the "-l" option. Eg: $> ./memcached -l 127.0.2.1:22122 If the port 22122 is available, things run smoothly. However, if the port is unavailable, we see the following error message: "failed to listen on TCP port 11211" Note that the port number is incorrect and is the default port number 11211 instead of the configured 22122. This is because the server_sockets() function treats settings.port and settings.inter differently. If "-l" is provided, settings.inter contains the correct port number, whereas settings.port the default port, and settings.port is used to print the error info, hence printing the incorrect port number. Since multiple interfaces can be provided with '-l', this patch prints all of them on a bind error, to maintain code simplicity. The server_sockets() function is also adjusted to remember the first bind error's 'errno' that occurs, as the caller of server_sockets() relies on the errno to print the error message.
- Loading branch information