X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=src%2Fclient.c;h=69a8aaebd099eb180452eb601098a2d55462645c;hb=532c5c9e14a48ec17d38dce5d904a3b612a2563b;hp=29c8bf5cd0f5b654cf6411e776449339d55e08ac;hpb=d339a58bd419901bf4294aaa138c000a8c2ae139;p=spider.git diff --git a/src/client.c b/src/client.c index 29c8bf5c..69a8aaeb 100644 --- a/src/client.c +++ b/src/client.c @@ -574,7 +574,7 @@ lend:; /* * set up the various mode flags, NL endings and things */ -void setmode(char *m) +void setconntype(char *m) { connsort = strlower(m); if (eq(connsort, "telnet") || eq(connsort, "local") || eq(connsort, "nlonly")) { @@ -809,9 +809,9 @@ lerr: die("Must have at least a callsign (for now)"); if (optind < argc) { - setmode(argv[optind]); + setconntype(argv[optind]); } else { - setmode("local"); + setconntype("local"); } /* this is kludgy, but hey so is the rest of this! */ @@ -825,8 +825,10 @@ void connect_to_node() struct hostent *hp, *gethostbyname(); struct sockaddr_in server; int nodef; + int one = 1; sel_t *sp; - + struct linger lg; + if ((hp = gethostbyname(node_addr)) == 0) die("Unknown host tcp host %s for printer", node_addr); @@ -842,6 +844,15 @@ void connect_to_node() if (connect(nodef, (struct sockaddr *) &server, sizeof server) < 0) { die("Error on connect to %s port %d (%d)", node_addr, node_port, errno); } + + memset(&lg, 0, sizeof lg); + if (setsockopt(nodef, SOL_SOCKET, SO_LINGER, &lg, sizeof lg) < 0) { + die("Error on SO_LINGER to %s port %d (%d)", node_addr, node_port, errno); + } + if (setsockopt(nodef, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof one) < 0) { + die("Error on SO_KEEPALIVE to %s port %d (%d)", node_addr, node_port, errno); + } + node = fcb_new(nodef, MSG); node->sp = sel_open(nodef, node, "Msg System", fcb_handler, MSG, SEL_INPUT); @@ -901,13 +912,6 @@ main(int argc, char *argv[]) #ifdef SIGPWR signal(SIGPWR, terminate); #endif -#ifdef SIGCLD - signal(SIGCLD, reaper); -#else - #ifdef SIGCHILD - signal(SIGCHILD, reaper); - #endif -#endif /* init a few things */ chain_init(&echobase);