… | |
… | |
1014 | slog (L_TRACE, "%s >> PT_PING", conf->nodename); |
1014 | slog (L_TRACE, "%s >> PT_PING", conf->nodename); |
1015 | |
1015 | |
1016 | // we send pings instead of auth packets after some retries, |
1016 | // we send pings instead of auth packets after some retries, |
1017 | // so reset the retry counter and establish a connection |
1017 | // so reset the retry counter and establish a connection |
1018 | // when we receive a ping. |
1018 | // when we receive a ping. |
1019 | if (!(ictx && octx)) |
1019 | if (!ictx) |
1020 | { |
1020 | { |
1021 | if (auth_rate_limiter.can (rsi)) |
1021 | if (auth_rate_limiter.can (rsi)) |
1022 | send_auth_request (rsi, true); |
1022 | send_auth_request (rsi, true); |
1023 | } |
1023 | } |
1024 | else |
1024 | else |
1025 | // we would love to change thre socket address here, but ping's aren't |
1025 | // we would love to change the socket address here, but ping's aren't |
1026 | // authenticated, so we best ignore it. |
1026 | // authenticated, so we best ignore it. |
1027 | send_ping (rsi, 1); // pong |
1027 | send_ping (rsi, 1); // pong |
1028 | |
1028 | |
1029 | break; |
1029 | break; |
1030 | |
1030 | |
1031 | case vpn_packet::PT_PONG: |
1031 | case vpn_packet::PT_PONG: |
1032 | slog (L_TRACE, "%s >> PT_PONG", conf->nodename); |
1032 | slog (L_TRACE, "%s >> PT_PONG", conf->nodename); |
|
|
1033 | |
|
|
1034 | // a PONG might mean that the other side doesn't really know |
|
|
1035 | // about our desire for communication. |
|
|
1036 | establish_connection (); |
1033 | break; |
1037 | break; |
1034 | |
1038 | |
1035 | case vpn_packet::PT_RESET: |
1039 | case vpn_packet::PT_RESET: |
1036 | { |
1040 | { |
1037 | reset_connection (); |
1041 | reset_connection (); |