mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
tt: prevent superfluous ttsession processes.
This commit is contained in:
parent
3795cdbd5e
commit
1ac963d735
2 changed files with 6 additions and 13 deletions
|
@ -358,6 +358,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
install_signal_handler();
|
install_signal_handler();
|
||||||
|
signal(SIGCHLD, SIG_DFL);
|
||||||
|
|
||||||
// set up a pipe which will be used by the child ttsession to
|
// set up a pipe which will be used by the child ttsession to
|
||||||
// communicate it's session id to the parent ttsession which
|
// communicate it's session id to the parent ttsession which
|
||||||
|
|
|
@ -150,7 +150,10 @@ init(_Tt_host_ptr &host, int program, int version,
|
||||||
memset(&_server_addr, 0, sizeof(_server_addr));
|
memset(&_server_addr, 0, sizeof(_server_addr));
|
||||||
_server_addr.sin_family = AF_INET;
|
_server_addr.sin_family = AF_INET;
|
||||||
_server_addr.sin_port = htons((optval) ? 0 : 4000);
|
_server_addr.sin_port = htons((optval) ? 0 : 4000);
|
||||||
_server_addr.sin_addr.s_addr = inet_addr((char *)(_host->stringaddr()));
|
|
||||||
|
if (!inet_aton((char *)(_host->stringaddr()), &_server_addr.sin_addr))
|
||||||
|
return 0;
|
||||||
|
|
||||||
_client = clnttcp_create(&_server_addr, _program,
|
_client = clnttcp_create(&_server_addr, _program,
|
||||||
_version, &_socket, 4000, 4000);
|
_version, &_socket, 4000, 4000);
|
||||||
if (_client == 0) {
|
if (_client == 0) {
|
||||||
|
@ -163,7 +166,7 @@ init(_Tt_host_ptr &host, int program, int version,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optval) {
|
if (optval) {
|
||||||
#ifndef linux
|
#ifdef SO_USELOOPBACK
|
||||||
if (setsockopt(_socket, SOL_SOCKET, SO_USELOOPBACK,
|
if (setsockopt(_socket, SOL_SOCKET, SO_USELOOPBACK,
|
||||||
(char *)&optval, sizeof(int)) == -1) {
|
(char *)&optval, sizeof(int)) == -1) {
|
||||||
_tt_syslog( 0, LOG_ERR, "_Tt_rpc_client::init(): "
|
_tt_syslog( 0, LOG_ERR, "_Tt_rpc_client::init(): "
|
||||||
|
@ -206,10 +209,6 @@ init(_Tt_host_ptr &host, int program, int version,
|
||||||
// Set close-on-exec bit so a libtt client which forks and execs won't
|
// Set close-on-exec bit so a libtt client which forks and execs won't
|
||||||
// be short some fd's in the child.
|
// be short some fd's in the child.
|
||||||
|
|
||||||
#if defined(__linux__)
|
|
||||||
// JET - for linux, we need to do this properly - I don't know
|
|
||||||
// how the original code below can be correct, so we'll do it
|
|
||||||
// differently.
|
|
||||||
{
|
{
|
||||||
long flags;
|
long flags;
|
||||||
|
|
||||||
|
@ -225,13 +224,6 @@ init(_Tt_host_ptr &host, int program, int version,
|
||||||
"fcntl(F_SETFD): %m");
|
"fcntl(F_SETFD): %m");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
if (-1==fcntl(_socket, F_SETFD, 1)) {
|
|
||||||
_tt_syslog( 0, LOG_ERR, "_Tt_rpc_client::init(): "
|
|
||||||
"fcntl(F_SETFD): %m");
|
|
||||||
}
|
|
||||||
#endif // linux
|
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue