Merge in slirp updates from QEMU:

- improved performance (still not visible in B2 part, especially passive mode)
- set SO_REUSEADDR before calling bind()
- win32 compile fix
This commit is contained in:
gbeauche 2006-03-25 07:57:38 +00:00
parent a4a070bc4a
commit 61fb95dd6f
3 changed files with 4 additions and 4 deletions

View File

@ -349,7 +349,7 @@ void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds)
* See if anything has timed out
*/
if (link_up) {
if (time_fasttimo && ((curtime - time_fasttimo) >= 199)) {
if (time_fasttimo && ((curtime - time_fasttimo) >= 2)) {
tcp_fasttimo();
time_fasttimo = 0;
}

View File

@ -575,6 +575,7 @@ solisten(port, laddr, lport, flags)
addr.sin_port = port;
if (((s = socket(AF_INET,SOCK_STREAM,0)) < 0) ||
(setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)) < 0) ||
(bind(s,(struct sockaddr *)&addr, sizeof(addr)) < 0) ||
(listen(s,1) < 0)) {
int tmperrno = errno; /* Don't clobber the real reason we failed */
@ -589,7 +590,6 @@ solisten(port, laddr, lport, flags)
#endif
return NULL;
}
setsockopt(s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int));
setsockopt(s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int));
getsockname(s,(struct sockaddr *)&addr,&addrlen);

View File

@ -425,7 +425,7 @@ struct cu_header {
uint32_t d_addr; // destination address
uint16_t s_family; // source family
uint16_t s_port; // source port
uint32_t s_addr; // source address
uint32_t so_addr; // source address
uint32_t seqn; // sequence number
uint16_t message; // message
uint16_t data_type; // data type
@ -617,7 +617,7 @@ struct cu_header {
return;
cu_head = mtod(m, struct cu_header *);
cu_head->s_port = addr.sin_port;
cu_head->s_addr = our_addr.s_addr;
cu_head->so_addr = our_addr.s_addr;
}
return;