1 | /* |
1 | /* |
2 | connection.C -- manage a single connection |
2 | connection.C -- manage a single connection |
3 | Copyright (C) 2003-2008 Marc Lehmann <gvpe@schmorp.de> |
3 | Copyright (C) 2003-2008,2010 Marc Lehmann <gvpe@schmorp.de> |
4 | |
4 | |
5 | This file is part of GVPE. |
5 | This file is part of GVPE. |
6 | |
6 | |
7 | GVPE is free software; you can redistribute it and/or modify it |
7 | GVPE is free software; you can redistribute it and/or modify it |
8 | under the terms of the GNU General Public License as published by the |
8 | under the terms of the GNU General Public License as published by the |
… | |
… | |
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 (); |