2 * $Id: atp_close.c,v 1.4 2001-06-29 14:14:46 rufustfirefly Exp $
4 * Copyright (c) 1990,1997 Regents of The University of Michigan.
5 * All Rights Reserved. See COPYRIGHT.
10 #endif /* HAVE_CONFIG_H */
13 #include <sys/types.h>
15 #include <sys/socket.h>
17 #include <netatalk/at.h>
18 #include <atalk/netddp.h>
19 #include <atalk/atp.h>
20 #include "atp_internals.h"
31 /* remove from list of open atp sockets & discard queued data
34 print_bufuse( ah, "atp_close");
37 while ( ah->atph_queue != NULL ) {
39 ah->atph_queue = cq->atpbuf_next;
43 while ( ah->atph_sent != NULL ) {
45 for ( i = 0; i < 8; ++i ) {
46 if ( cq->atpbuf_info.atpbuf_xo.atpxo_packet[ i ] != NULL ) {
47 atp_free_buf( cq->atpbuf_info.atpbuf_xo.atpxo_packet[ i ] );
50 ah->atph_sent = cq->atpbuf_next;
54 if ( ah->atph_reqpkt != NULL ) {
55 atp_free_buf( ah->atph_reqpkt );
56 ah->atph_reqpkt = NULL;
59 for ( i = 0; i < 8; ++i ) {
60 if ( ah->atph_resppkt[ i ] != NULL ) {
61 atp_free_buf( ah->atph_resppkt[ i ] );
62 ah->atph_resppkt[ i ] = NULL;
67 print_bufuse( ah, "atp_close end");
71 atp_free_buf( (struct atpbuf *) ah );
73 if (netddp_close(i) < 0)