mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-01-19 14:29:34 +08:00
trival
This commit is contained in:
parent
184b198470
commit
7ad9a6987c
15
network.cpp
15
network.cpp
@ -2464,8 +2464,10 @@ int try_to_list_and_bind(int &fd,u32_t local_ip_uint32,int port) //try to bind
|
|||||||
}*/
|
}*/
|
||||||
int try_to_list_and_bind2(int &fd,address_t address) //try to bind to a port,may fail.
|
int try_to_list_and_bind2(int &fd,address_t address) //try to bind to a port,may fail.
|
||||||
{
|
{
|
||||||
int old_bind_fd=fd;
|
if(fd!=-1)
|
||||||
|
{
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
if(raw_mode==mode_faketcp)
|
if(raw_mode==mode_faketcp)
|
||||||
{
|
{
|
||||||
fd=socket(address.get_type(),SOCK_STREAM,0);
|
fd=socket(address.get_type(),SOCK_STREAM,0);
|
||||||
@ -2474,11 +2476,12 @@ int try_to_list_and_bind2(int &fd,address_t address) //try to bind to a port,ma
|
|||||||
{
|
{
|
||||||
fd=socket(address.get_type(),SOCK_DGRAM,0);
|
fd=socket(address.get_type(),SOCK_DGRAM,0);
|
||||||
}
|
}
|
||||||
if(old_bind_fd!=-1)
|
|
||||||
{
|
|
||||||
close(old_bind_fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(fd==-1)
|
||||||
|
{
|
||||||
|
mylog(log_debug,"create fd fail\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
/*struct sockaddr_in temp_bind_addr={0};
|
/*struct sockaddr_in temp_bind_addr={0};
|
||||||
//bzero(&temp_bind_addr, sizeof(temp_bind_addr));
|
//bzero(&temp_bind_addr, sizeof(temp_bind_addr));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user