[DCCP]: Initialise write_xmit_timer also on passive sockets
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Fri, 9 Mar 2007 21:47:58 +0000 (13:47 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Mar 2007 21:47:58 +0000 (13:47 -0800)
The TX CCID needs the write_xmit_timer for delaying packet sends. Previously
this timer was only activated on active (connecting) sockets.

This patch initialises the write_xmit_timer in sync with the other timers, i.e.
the timer will be ready on any socket. This is used by applications with a
listening socket which start to stream after receiving an initiation by the
client.  The write_xmit_timer is stopped when the application closes, as before.

Was tested to work and to remove the timer bug reported on dccp@vger.

Also moved timer initialisation into timer.c (static).

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/dccp.h
net/dccp/output.c
net/dccp/timer.c

index e33a9edb40363ef7c964de7de3eb55c0c81d7846..a0e7cd183a5d3e648d40bf81b6a3d6420c9931bd 100644 (file)
@@ -191,6 +191,7 @@ extern void dccp_send_sync(struct sock *sk, const u64 seq,
                           const enum dccp_pkt_type pkt_type);
 
 extern void dccp_write_xmit(struct sock *sk, int block);
+extern void dccp_write_xmit_timer(unsigned long data);
 extern void dccp_write_space(struct sock *sk);
 
 extern void dccp_init_xmit_timers(struct sock *sk);
index 3282f2f2291b3bcb313e0feaeaa91dea5824622e..aa21cc4de37f7b77c84cd38d6d901a1027810471 100644 (file)
@@ -213,19 +213,6 @@ do_interrupted:
        goto out;
 }
 
-static void dccp_write_xmit_timer(unsigned long data) {
-       struct sock *sk = (struct sock *)data;
-       struct dccp_sock *dp = dccp_sk(sk);
-
-       bh_lock_sock(sk);
-       if (sock_owned_by_user(sk))
-               sk_reset_timer(sk, &dp->dccps_xmit_timer, jiffies+1);
-       else
-               dccp_write_xmit(sk, 0);
-       bh_unlock_sock(sk);
-       sock_put(sk);
-}
-
 void dccp_write_xmit(struct sock *sk, int block)
 {
        struct dccp_sock *dp = dccp_sk(sk);
@@ -434,9 +421,6 @@ static inline void dccp_connect_init(struct sock *sk)
        dp->dccps_gar = dp->dccps_iss;
 
        icsk->icsk_retransmits = 0;
-       init_timer(&dp->dccps_xmit_timer);
-       dp->dccps_xmit_timer.data = (unsigned long)sk;
-       dp->dccps_xmit_timer.function = dccp_write_xmit_timer;
 }
 
 int dccp_connect(struct sock *sk)
index 41ea0f6594c4a5b26e82247cddc3539f90f06001..b038a0a3ad40a1fcbc182c6f66e37a2171120144 100644 (file)
@@ -261,8 +261,33 @@ out:
        sock_put(sk);
 }
 
+/* Transmit-delay timer: used by the CCIDs to delay actual send time */
+void dccp_write_xmit_timer(unsigned long data)
+{
+       struct sock *sk = (struct sock *)data;
+       struct dccp_sock *dp = dccp_sk(sk);
+
+       bh_lock_sock(sk);
+       if (sock_owned_by_user(sk))
+               sk_reset_timer(sk, &dp->dccps_xmit_timer, jiffies+1);
+       else
+               dccp_write_xmit(sk, 0);
+       bh_unlock_sock(sk);
+       sock_put(sk);
+}
+
+static void dccp_init_write_xmit_timer(struct sock *sk)
+{
+       struct dccp_sock *dp = dccp_sk(sk);
+
+       init_timer(&dp->dccps_xmit_timer);
+       dp->dccps_xmit_timer.data = (unsigned long)sk;
+       dp->dccps_xmit_timer.function = dccp_write_xmit_timer;
+}
+
 void dccp_init_xmit_timers(struct sock *sk)
 {
+       dccp_init_write_xmit_timer(sk);
        inet_csk_init_xmit_timers(sk, &dccp_write_timer, &dccp_delack_timer,
                                  &dccp_keepalive_timer);
 }
This page took 0.07165 seconds and 5 git commands to generate.