mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Made IP_Port a union.
This commit is contained in:
parent
205ba48a5a
commit
d2d1af2ce9
|
@ -675,7 +675,7 @@ IP_Port DHT_getfriendip(DHT *dht, uint8_t *client_id)
|
||||||
{
|
{
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
uint64_t temp_time = unix_time();
|
uint64_t temp_time = unix_time();
|
||||||
IP_Port empty = {{{0}}, 0};
|
IP_Port empty = { .ip = {0}, .port = 0, .padding = 0 };
|
||||||
|
|
||||||
for (i = 0; i < dht->num_friends; ++i) {
|
for (i = 0; i < dht->num_friends; ++i) {
|
||||||
/* Equal */
|
/* Equal */
|
||||||
|
|
|
@ -302,7 +302,7 @@ IP_Port connection_ip(Lossless_UDP *ludp, int connection_id)
|
||||||
if (connection_id >= 0 && connection_id < ludp->connections_length)
|
if (connection_id >= 0 && connection_id < ludp->connections_length)
|
||||||
return ludp->connections[connection_id].ip_port;
|
return ludp->connections[connection_id].ip_port;
|
||||||
|
|
||||||
IP_Port zero = {{{0}}, 0};
|
IP_Port zero = { .ip = {0}, .port = 0, .padding = 0 };
|
||||||
return zero;
|
return zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,11 +86,14 @@ typedef union {
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
} IP;
|
} IP;
|
||||||
|
|
||||||
typedef struct {
|
typedef union {
|
||||||
IP ip;
|
struct {
|
||||||
uint16_t port;
|
IP ip;
|
||||||
/* Not used for anything right now. */
|
uint16_t port;
|
||||||
uint16_t padding;
|
/* Not used for anything right now. */
|
||||||
|
uint16_t padding;
|
||||||
|
};
|
||||||
|
uint8_t uint8[8];
|
||||||
} IP_Port;
|
} IP_Port;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user