patch-2.0.15 linux/net/ipv4/tcp.c
Next file: linux/Makefile
Previous file: linux/net/ipv4/ip_fw.c
Back to the patch index
Back to the overall index
- Lines: 33
- Date:
Sat Aug 24 10:38:57 1996
- Orig file:
v2.0.14/linux/net/ipv4/tcp.c
- Orig date:
Mon Aug 5 10:13:55 1996
diff -u --recursive --new-file v2.0.14/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
@@ -867,15 +867,24 @@
static void wait_for_tcp_memory(struct sock * sk)
{
release_sock(sk);
- cli();
- if (!tcp_memory_free(sk) &&
- (sk->state == TCP_ESTABLISHED||sk->state == TCP_CLOSE_WAIT)
- && sk->err == 0 /* && check shutdown ?? */)
- {
+ if (!tcp_memory_free(sk)) {
+ struct wait_queue wait = { current, NULL };
+
sk->socket->flags &= ~SO_NOSPACE;
- interruptible_sleep_on(sk->sleep);
+ add_wait_queue(sk->sleep, &wait);
+ for (;;) {
+ current->state = TASK_INTERRUPTIBLE;
+ if (tcp_memory_free(sk))
+ break;
+ if (sk->shutdown & SEND_SHUTDOWN)
+ break;
+ if (sk->err)
+ break;
+ schedule();
+ }
+ current->state = TASK_RUNNING;
+ remove_wait_queue(sk->sleep, &wait);
}
- sti();
lock_sock(sk);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov