Skip to content
Snippets Groups Projects
Commit 6d7d9563 authored by rswindell's avatar rswindell
Browse files

For Unix-domain sockets (e.g. localspy sockets on *nix), use the [unix]

section of the sockopts.ini (if there is one) rather than the [tcp] or
[udp] sections. This resolves the errors:
      term xxxx !ERROR 95 setting socket option (TCP_NODELAY, 1) to 1
which started appearing after the TCP_NODELAY option was added to the
[tcp] section.
parent 875610d9
No related branches found
No related tags found
No related merge requests found
/* sockopts.c */
// vi: tabstop=4
/* Set socket options based on contents of ctrl/sockopts.ini */
......@@ -64,8 +65,14 @@ int DLLCALL set_socket_options(scfg_t* cfg, SOCKET sock, const char* protocol, c
result=iniGetSocketOptions(list,ROOT_SECTION,sock,error,errlen);
if(result==0)
result=iniGetSocketOptions(list,type==SOCK_STREAM ? "tcp":"udp",sock,error,errlen);
if(result==0) {
const char* section = (type==SOCK_STREAM) ? "tcp":"udp";
struct sockaddr sockaddr;
socklen_t len = sizeof(sockaddr);
if(getsockname(sock, &sockaddr, &len) == 0 && sockaddr.sa_family == PF_UNIX)
section = "unix";
result=iniGetSocketOptions(list,section,sock,error,errlen);
}
if(result==0 && protocol!=NULL && *protocol!=0)
result=iniGetSocketOptions(list,protocol,sock,error,errlen);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment