VirtualBox

Ignore:
Timestamp:
Jun 5, 2009 5:38:25 AM (16 years ago)
Author:
vboxsync
Message:

NAT: make port-forwarding the same speed as guest->remote

File:
1 edited

Legend:

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

    r19839 r20297  
    691691    socklen_t addrlen = sizeof(addr);
    692692    int s, opt = 1;
     693    int status;
    693694
    694695    DEBUG_CALL("solisten");
     
    756757        return NULL;
    757758    }
     759    fd_nonblock(s);
    758760    setsockopt(s, SOL_SOCKET, SO_OOBINLINE,(char *)&opt, sizeof(int));
    759761
    760762    getsockname(s,(struct sockaddr *)&addr,&addrlen);
    761763    so->so_fport = addr.sin_port;
     764    /* set socket buffers */
     765    opt = 64 * _1K;
     766    status = setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, sizeof(int));
     767    if (status < 0)
     768    {
     769        LogRel(("NAT: Error(%d) while setting RCV capacity to (%d)\n", errno, opt));
     770        goto no_sockopt;
     771    }
     772    opt = 64 * _1K;
     773    status = setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, sizeof(int));
     774    if (status < 0)
     775    {
     776        LogRel(("NAT: Error(%d) while setting SND capacity to (%d)\n", errno, opt));
     777        goto no_sockopt;
     778    }
     779no_sockopt:
    762780    if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr)
    763781        so->so_faddr = alias_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