*s->prev = s->next; if (s->next != NULL) s->next->prev = s->prev;
static void mactcp_close(Socket sock){    Actual_Socket s = (Actual_Socket)sock;    TCPiopb pb;    /*     * TCPClose is equivalent to shutdown(fd, SHUT_WR), and hence     * leaves the Rx side open, while TCPAbort seems rather vicious,     * throwing away Tx data that haven't been ACKed yet.  We do both     * in succession.     */    pb.ioCRefNum = mactcp.refnum;    pb.csCode = TCPClose;    pb.tcpStream = s->s;    pb.csParam.close.validityFlags = 0;    pb.csParam.close.userDataPtr = (Ptr)s;    s->err = PBControlSync((ParmBlkPtr)&pb);    /* Not much we can do about an error anyway. */    pb.ioCRefNum = mactcp.refnum;    pb.csCode = TCPAbort;    pb.tcpStream = s->s;    pb.csParam.abort.userDataPtr = (Ptr)s;    s->err = PBControlSync((ParmBlkPtr)&pb);    /* Even less we can do about an error here. */    pb.ioCRefNum = mactcp.refnum;    pb.csCode = TCPRelease;    pb.tcpStream = s->s;    pb.csParam.create.userDataPtr = (Ptr)s;    s->err = PBControlSync((ParmBlkPtr)&pb);    if (s->err == noErr)	sfree(pb.csParam.create.rcvBuff);    sfree(s);}