Skip to content

Commit

Permalink
have tcp6_drain
Browse files Browse the repository at this point in the history
  • Loading branch information
itojun committed Mar 15, 2002
1 parent f59d5df commit c8c043c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
15 changes: 12 additions & 3 deletions kame/sys/netinet6/in6_proto.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: in6_proto.c,v 1.112 2002/01/08 02:40:56 k-sugyou Exp $ */
/* $KAME: in6_proto.c,v 1.113 2002/03/15 09:28:53 itojun Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -272,9 +272,18 @@ struct ip6protosw inet6sw[] = {
tcp_usrreq,
#endif
#ifdef INET /* don't call initialization and timeout routines twice */
0, 0, 0, tcp_drain,
0, 0, 0,
#else
tcp_init, tcp_fasttimo, tcp_slowtimo,
#endif
#ifdef __NetBSD__
tcp6_drain,
#else
tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain,
#ifdef INET
0,
#else
tcp_drain,
#endif
#endif
#ifndef __FreeBSD__
tcp_sysctl,
Expand Down
28 changes: 28 additions & 0 deletions netbsd/sys/netinet/tcp_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,34 @@ tcp_drain()
}
}

#ifdef INET6
void
tcp6_drain()
{
struct in6pcb *in6p;
struct tcpcb *tp;
struct in6pcb *head = &tcb6;

/*
* Free the sequence queue of all TCP connections.
*/
for (in6p = head->in6p_next; in6p != head; in6p = in6p->in6p_next) {
if ((tp = in6totcpcb(in6p)) != NULL) {
/*
* We may be called from a device's interrupt
* context. If the tcpcb is already busy,
* just bail out now.
*/
if (tcp_reass_lock_try(tp) == 0)
continue;
if (tcp_freeq(tp))
tcpstat.tcps_connsdrained++;
TCP_REASS_UNLOCK(tp);
}
}
}
#endif

/*
* Notify a tcp user of an asynchronous error;
* store error as soft error, but wake up user
Expand Down
3 changes: 3 additions & 0 deletions netbsd/sys/netinet/tcp_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,9 @@ struct tcpcb *
void tcp_dooptions __P((struct tcpcb *,
u_char *, int, struct tcphdr *, struct tcp_opt_info *));
void tcp_drain __P((void));
#ifdef INET6
void tcp6_drain __P((void));
#endif
void tcp_established __P((struct tcpcb *));
void tcp_fasttimo __P((void));
void tcp_init __P((void));
Expand Down

0 comments on commit c8c043c

Please sign in to comment.