char *str = (ret == 0 ? "Internal networking trouble" : error_string(errno));
const char *str = (ret == 0 ? "Internal networking trouble" : error_string(errno));
static int net_select_result(int fd, int event){    int ret;    int err;    char buf[20480];		       /* nice big buffer for plenty of speed */    Actual_Socket s;    u_long atmark;    /* Find the Socket structure */    s = find234(sktree, (void *) fd, cmpforsearch);    if (!s)	return 1;		       /* boggle */    noise_ultralight(event);    switch (event) {      case 4:			       /* exceptional */	if (!s->oobinline) {	    /*	     * On a non-oobinline socket, this indicates that we	     * can immediately perform an OOB read and get back OOB	     * data, which we will send to the back end with	     * type==2 (urgent data).	     */	    ret = recv(s->s, buf, sizeof(buf), MSG_OOB);	    noise_ultralight(ret);	    if (ret <= 0) {		char *str = (ret == 0 ? "Internal networking trouble" :			     error_string(errno));		/* We're inside the Unix frontend here, so we know		 * that the frontend handle is unnecessary. */		logevent(NULL, str);		fatalbox("%s", str);	    } else {		return plug_receive(s->plug, 2, buf, ret);	    }	    break;	}	/*	 * If we reach here, this is an oobinline socket, which	 * means we should set s->oobpending and then deal with it	 * when we get called for the readability event (which	 * should also occur).	 */	s->oobpending = TRUE;        break;      case 1: 			       /* readable; also acceptance */	if (s->listener) {	    /*	     * On a listening socket, the readability event means a	     * connection is ready to be accepted.	     */	    struct sockaddr_in isa;	    int addrlen = sizeof(struct sockaddr_in);	    int t;  /* socket of connection */	    memset(&isa, 0, sizeof(struct sockaddr_in));	    err = 0;	    t = accept(s->s,(struct sockaddr *)&isa,&addrlen);	    if (t < 0) {		break;	    }	    if (s->localhost_only && !ipv4_is_loopback(isa.sin_addr)) {		close(t);	       /* someone let nonlocal through?! */	    } else if (plug_accepting(s->plug, (void*)t)) {		close(t);	       /* denied or error */	    }	    break;	}	/*	 * If we reach here, this is not a listening socket, so	 * readability really means readability.	 */	/* In the case the socket is still frozen, we don't even bother */	if (s->frozen) {	    s->frozen_readable = 1;	    break;	}	/*	 * We have received data on the socket. For an oobinline	 * socket, this might be data _before_ an urgent pointer,	 * in which case we send it to the back end with type==1	 * (data prior to urgent).	 */	if (s->oobinline && s->oobpending) {	    atmark = 1;	    if (ioctl(s->s, SIOCATMARK, &atmark) == 0 && atmark)		s->oobpending = FALSE; /* clear this indicator */	} else	    atmark = 1;	ret = recv(s->s, buf, s->oobpending ? 1 : sizeof(buf), 0);	noise_ultralight(ret);	if (ret < 0) {	    if (errno == EWOULDBLOCK) {		break;	    }	}	if (ret < 0) {	    return plug_closing(s->plug, error_string(errno), errno, 0);	} else if (0 == ret) {	    return plug_closing(s->plug, NULL, 0, 0);	} else {	    return plug_receive(s->plug, atmark ? 0 : 1, buf, ret);	}	break;      case 2:			       /* writable */	if (!s->connected) {	    /*	     * select() reports a socket as _writable_ when an	     * asynchronous connection is completed.	     */	    s->connected = s->writable = 1;	    uxsel_tell(s);	    break;	} else {	    int bufsize_before, bufsize_after;	    s->writable = 1;	    bufsize_before = s->sending_oob + bufchain_size(&s->output_data);	    try_send(s);	    bufsize_after = s->sending_oob + bufchain_size(&s->output_data);	    if (bufsize_after < bufsize_before)		plug_sent(s->plug, bufsize_after);	}	break;    }    return 1;}