mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-19 06:19:34 +08:00
fixed ipv6 in -r
This commit is contained in:
parent
4d4a9673e1
commit
d4564b6249
@ -881,7 +881,7 @@ int create_fifo(char * file)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
int new_listen_socket(int &fd,u32_t ip,int port)
|
int new_listen_socket(int &fd,u32_t ip,int port)
|
||||||
{
|
{
|
||||||
fd =socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
fd =socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||||
@ -939,7 +939,7 @@ int new_connected_socket(int &fd,u32_t ip,int port)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
int new_listen_socket2(int &fd,address_t &addr)
|
int new_listen_socket2(int &fd,address_t &addr)
|
||||||
{
|
{
|
||||||
fd =socket(addr.get_type(), SOCK_DGRAM, IPPROTO_UDP);
|
fd =socket(addr.get_type(), SOCK_DGRAM, IPPROTO_UDP);
|
||||||
@ -960,7 +960,7 @@ int new_listen_socket2(int &fd,address_t &addr)
|
|||||||
}
|
}
|
||||||
int new_connected_socket2(int &fd,address_t &addr)
|
int new_connected_socket2(int &fd,address_t &addr)
|
||||||
{
|
{
|
||||||
fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
fd = socket(addr.get_type(), SOCK_DGRAM, IPPROTO_UDP);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
mylog(log_warn, "[%s]create udp_fd error\n", addr.get_str());
|
mylog(log_warn, "[%s]create udp_fd error\n", addr.get_str());
|
||||||
return -1;
|
return -1;
|
||||||
|
5
common.h
5
common.h
@ -233,6 +233,7 @@ struct address_t //TODO scope id
|
|||||||
{
|
{
|
||||||
memset(&inner,0,sizeof(inner));
|
memset(&inner,0,sizeof(inner));
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
int from_ip_port(u32_t ip, int port)
|
int from_ip_port(u32_t ip, int port)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
@ -240,7 +241,7 @@ struct address_t //TODO scope id
|
|||||||
inner.ipv4.sin_port=htons(port);
|
inner.ipv4.sin_port=htons(port);
|
||||||
inner.ipv4.sin_addr.s_addr=ip;
|
inner.ipv4.sin_addr.s_addr=ip;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
int from_ip_port_new(int type, void * ip, int port)
|
int from_ip_port_new(int type, void * ip, int port)
|
||||||
{
|
{
|
||||||
@ -253,7 +254,7 @@ struct address_t //TODO scope id
|
|||||||
}
|
}
|
||||||
else if(type==AF_INET6)
|
else if(type==AF_INET6)
|
||||||
{
|
{
|
||||||
inner.ipv6.sin6_family=AF_INET;
|
inner.ipv6.sin6_family=AF_INET6;
|
||||||
inner.ipv6.sin6_port=htons(port);
|
inner.ipv6.sin6_port=htons(port);
|
||||||
inner.ipv6.sin6_addr=*((in6_addr*)ip);
|
inner.ipv6.sin6_addr=*((in6_addr*)ip);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user