VirtualBox

Ignore:
Timestamp:
Feb 5, 2009 3:35:30 PM (16 years ago)
Author:
vboxsync
Message:

NAT:port-forwarding: Default value for SND/RCV buffers increased 4x

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/tcp_subr.c

    r16449 r16529  
    450450    socklen_t addrlen = sizeof(struct sockaddr_in);
    451451    struct tcpcb *tp;
    452     int s, opt;
     452    int s, opt, optlen, status;
    453453
    454454    DEBUG_CALL("tcp_connect");
     
    496496    setsockopt(s,IPPROTO_TCP,TCP_NODELAY,(char *)&opt,sizeof(int));
    497497
     498    optlen = sizeof(int);
     499    status = getsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, &optlen);
     500    if (status < 0)
     501    {
     502        LogRel(("Error(%d) while getting RCV capacity\n", errno));
     503        goto no_sockopt;
     504    }
     505    opt *= 4;
     506    status = setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, optlen);
     507    if (status < 0)
     508    {
     509        LogRel(("Error(%d) while setting RCV capacity to (%d)\n", errno, opt));
     510        goto no_sockopt;
     511    }
     512    status = getsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, &optlen);
     513    if (status < 0)
     514    {
     515        LogRel(("Error(%d) while getting SND capacity\n", errno));
     516        goto no_sockopt;
     517    }
     518    opt *= 4;
     519    status = setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, optlen);
     520    if (status < 0)
     521    {
     522        LogRel(("Error(%d) while setting SND capacity to (%d)\n", errno, opt));
     523        goto no_sockopt;
     524    }
     525
     526    no_sockopt:
    498527    so->so_fport = addr.sin_port;
    499528    so->so_faddr = addr.sin_addr;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette