sync easyfaketcp,fixed a bug in try_to_list_and_bind2

This commit is contained in:
wangyu-
2018-08-29 12:19:09 -05:00
parent a4aba62656
commit 4e9000c6b5
3 changed files with 48 additions and 11 deletions

View File

@@ -2495,7 +2495,7 @@ int try_to_list_and_bind2(int &fd,address_t address) //try to bind to a port,ma
mylog(log_debug,"bind fail\n");
return -1;
}
if(raw_mode==mode_faketcp)
if(raw_mode==mode_faketcp&&!use_tcp_dummy_socket)
{
if (listen(fd, SOMAXCONN) != 0) {
@@ -2528,7 +2528,8 @@ int client_bind_to_a_new_port2(int &fd,const address_t& address)//find a free po
for(int i=0;i<1000;i++)//try 1000 times at max,this should be enough
{
tmp.set_port(raw_send_port);
if (try_to_list_and_bind2(fd,address)==0)
printf("<%s>\n",tmp.get_str());
if (try_to_list_and_bind2(fd,tmp)==0)
{
return raw_send_port;
}