udp: Prepare for the asynchronized pru_send
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sat, 3 Dec 2011 13:41:17 +0000 (21:41 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 4 Dec 2011 11:24:55 +0000 (19:24 +0800)
Save necessary netmsg information into stack variables

sys/netinet/udp_usrreq.c

index d8ea10f..09ffe46 100644 (file)
@@ -1238,6 +1238,7 @@ static void
 udp_send(netmsg_t msg)
 {
        struct socket *so = msg->send.base.nm_so;
+       struct mbuf *m = msg->send.nm_m;
        struct inpcb *inp;
        int error;
 
@@ -1246,15 +1247,14 @@ udp_send(netmsg_t msg)
 
        inp = so->so_pcb;
        if (inp) {
-               error = udp_output(inp,
-                                  msg->send.nm_m,
-                                  msg->send.nm_addr,
-                                  msg->send.nm_td);
+               struct sockaddr *addr = msg->send.nm_addr;
+               struct thread *td = msg->send.nm_td;
+
+               error = udp_output(inp, m, addr, td);
        } else {
-               m_freem(msg->send.nm_m);
+               m_freem(m);
                error = EINVAL;
        }
-       msg->send.nm_m = NULL;
        lwkt_replymsg(&msg->send.base.lmsg, error);
 }