2 * $Id: atp_close.c,v 1.5 2009-10-13 22:55:37 didg 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"
30 /* remove from list of open atp sockets & discard queued data
33 print_bufuse( ah, "atp_close");
36 while ( ah->atph_queue != NULL ) {
38 ah->atph_queue = cq->atpbuf_next;
42 while ( ah->atph_sent != NULL ) {
44 for ( i = 0; i < 8; ++i ) {
45 if ( cq->atpbuf_info.atpbuf_xo.atpxo_packet[ i ] != NULL ) {
46 atp_free_buf( cq->atpbuf_info.atpbuf_xo.atpxo_packet[ i ] );
49 ah->atph_sent = cq->atpbuf_next;
53 if ( ah->atph_reqpkt != NULL ) {
54 atp_free_buf( ah->atph_reqpkt );
55 ah->atph_reqpkt = NULL;
58 for ( i = 0; i < 8; ++i ) {
59 if ( ah->atph_resppkt[ i ] != NULL ) {
60 atp_free_buf( ah->atph_resppkt[ i ] );
61 ah->atph_resppkt[ i ] = NULL;
66 print_bufuse( ah, "atp_close end");
70 atp_free_buf( (struct atpbuf *) ah );
72 if (netddp_close(i) < 0)