diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-11-02 08:56:54 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-11-02 08:56:54 +0100 |
commit | 74b73a980b91799843f8004edd90387ac482af46 (patch) | |
tree | 837a5eadf2ab3316168f5ebf4cca954b232034cb /src/peer.c | |
parent | cb98cbc593309d4781dfb873b018a5d4e12ad118 (diff) | |
download | fastd-74b73a980b91799843f8004edd90387ac482af46.tar fastd-74b73a980b91799843f8004edd90387ac482af46.zip |
Keep track of corresonding peers in associated sockets
Diffstat (limited to 'src/peer.c')
-rw-r--r-- | src/peer.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -149,6 +149,9 @@ static void on_disestablish(fastd_context *ctx, fastd_peer *peer) { static inline void free_socket(fastd_context *ctx, fastd_peer *peer) { if (peer->sock) { if (fastd_peer_is_socket_dynamic(peer)) { + if (peer->sock->peer != peer) + exit_bug(ctx, "dynamic peer socket mismatch"); + fastd_socket_close(ctx, peer->sock); free(peer->sock); } @@ -169,14 +172,14 @@ void fastd_peer_reset_socket(fastd_context *ctx, fastd_peer *peer) { if (ctx->sock_default_v4) peer->sock = ctx->sock_default_v4; else - peer->sock = fastd_socket_open(ctx, AF_INET); + peer->sock = fastd_socket_open(ctx, peer, AF_INET); break; case AF_INET6: if (ctx->sock_default_v6) peer->sock = ctx->sock_default_v6; else - peer->sock = fastd_socket_open(ctx, AF_INET6); + peer->sock = fastd_socket_open(ctx, peer, AF_INET6); } } |