diff options
-rw-r--r-- | toxcore/net_crypto.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 3f74cf04..3bc2ce33 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -856,45 +856,6 @@ static int handle_cryptohandshake(Net_Crypto *c, uint8_t *public_key, uint8_t *s | |||
856 | return 1; | 856 | return 1; |
857 | } | 857 | } |
858 | 858 | ||
859 | /* Get crypto connection id from public key of peer. | ||
860 | * | ||
861 | * return -1 if there are no connections like we are looking for. | ||
862 | * return id if it found it. | ||
863 | */ | ||
864 | static int getcryptconnection_id(Net_Crypto *c, uint8_t *public_key) | ||
865 | { | ||
866 | uint32_t i; | ||
867 | |||
868 | for (i = 0; i < c->crypto_connections_length; ++i) { | ||
869 | if (c->crypto_connections[i].status != CRYPTO_CONN_NO_CONNECTION) | ||
870 | if (memcmp(public_key, c->crypto_connections[i].public_key, crypto_box_PUBLICKEYBYTES) == 0) | ||
871 | return i; | ||
872 | } | ||
873 | |||
874 | return -1; | ||
875 | } | ||
876 | |||
877 | /* Set the size of the friend list to numfriends. | ||
878 | * | ||
879 | * return -1 if realloc fails. | ||
880 | * return 0 if it succeeds. | ||
881 | */ | ||
882 | static int realloc_cryptoconnection(Net_Crypto *c, uint32_t num) | ||
883 | { | ||
884 | if (num == 0) { | ||
885 | free(c->crypto_connections); | ||
886 | c->crypto_connections = NULL; | ||
887 | return 0; | ||
888 | } | ||
889 | |||
890 | Crypto_Connection *newcrypto_connections = realloc(c->crypto_connections, num * sizeof(Crypto_Connection)); | ||
891 | |||
892 | if (newcrypto_connections == NULL) | ||
893 | return -1; | ||
894 | |||
895 | c->crypto_connections = newcrypto_connections; | ||
896 | return 0; | ||
897 | } | ||
898 | 859 | ||
899 | /* Start a secure connection with other peer who has public_key and ip_port. | 860 | /* Start a secure connection with other peer who has public_key and ip_port. |
900 | * | 861 | * |