Deleted Added
full compact
smb_trantcp.c (130480) smb_trantcp.c (130653)
1/*
2 * Copyright (c) 2000-2001 Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*
2 * Copyright (c) 2000-2001 Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 17 unchanged lines hidden (view full) ---

26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netsmb/smb_trantcp.c 130480 2004-06-14 18:16:22Z rwatson $");
34__FBSDID("$FreeBSD: head/sys/netsmb/smb_trantcp.c 130653 2004-06-17 22:48:11Z rwatson $");
35
36#include <sys/param.h>
37#include <sys/condvar.h>
38#include <sys/kernel.h>
39#include <sys/lock.h>
40#include <sys/malloc.h>
41#include <sys/mbuf.h>
42#include <sys/poll.h>

--- 190 unchanged lines hidden (view full) ---

233
234 error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP,
235 td->td_ucred, td);
236 if (error)
237 return error;
238 nbp->nbp_tso = so;
239 so->so_upcallarg = (caddr_t)nbp;
240 so->so_upcall = nb_upcall;
35
36#include <sys/param.h>
37#include <sys/condvar.h>
38#include <sys/kernel.h>
39#include <sys/lock.h>
40#include <sys/malloc.h>
41#include <sys/mbuf.h>
42#include <sys/poll.h>

--- 190 unchanged lines hidden (view full) ---

233
234 error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP,
235 td->td_ucred, td);
236 if (error)
237 return error;
238 nbp->nbp_tso = so;
239 so->so_upcallarg = (caddr_t)nbp;
240 so->so_upcall = nb_upcall;
241 SOCKBUF_LOCK(&so->so_rcv);
241 so->so_rcv.sb_flags |= SB_UPCALL;
242 so->so_rcv.sb_flags |= SB_UPCALL;
243 SOCKBUF_UNLOCK(&so->so_rcv);
242 so->so_rcv.sb_timeo = (5 * hz);
243 so->so_snd.sb_timeo = (5 * hz);
244 error = soreserve(so, nbp->nbp_sndbuf, nbp->nbp_rcvbuf);
245 if (error)
246 goto bad;
247 nb_setsockopt_int(so, SOL_SOCKET, SO_KEEPALIVE, 1);
248 nb_setsockopt_int(so, IPPROTO_TCP, TCP_NODELAY, 1);
244 so->so_rcv.sb_timeo = (5 * hz);
245 so->so_snd.sb_timeo = (5 * hz);
246 error = soreserve(so, nbp->nbp_sndbuf, nbp->nbp_rcvbuf);
247 if (error)
248 goto bad;
249 nb_setsockopt_int(so, SOL_SOCKET, SO_KEEPALIVE, 1);
250 nb_setsockopt_int(so, IPPROTO_TCP, TCP_NODELAY, 1);
251 SOCKBUF_LOCK(&so->so_rcv);
249 so->so_rcv.sb_flags &= ~SB_NOINTR;
252 so->so_rcv.sb_flags &= ~SB_NOINTR;
253 SOCKBUF_UNLOCK(&so->so_rcv);
254 SOCKBUF_LOCK(&so->so_snd);
250 so->so_snd.sb_flags &= ~SB_NOINTR;
255 so->so_snd.sb_flags &= ~SB_NOINTR;
256 SOCKBUF_UNLOCK(&so->so_snd);
251 error = soconnect(so, (struct sockaddr*)to, td);
252 if (error)
253 goto bad;
254 s = splnet();
255 while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
256 tsleep(&so->so_timeo, PSOCK, "nbcon", 2 * hz);
257 if ((so->so_state & SS_ISCONNECTING) && so->so_error == 0 &&
258 (error = nb_intr(nbp, td->td_proc)) != 0) {

--- 499 unchanged lines hidden ---
257 error = soconnect(so, (struct sockaddr*)to, td);
258 if (error)
259 goto bad;
260 s = splnet();
261 while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
262 tsleep(&so->so_timeo, PSOCK, "nbcon", 2 * hz);
263 if ((so->so_state & SS_ISCONNECTING) && so->so_error == 0 &&
264 (error = nb_intr(nbp, td->td_proc)) != 0) {

--- 499 unchanged lines hidden ---