The server makes sure that if either side only supports a pre-release * version of a protocol, that both sides must speak a compatible version * of that protocol for it to be advertised as available. */
| 131 | * version of a protocol, that both sides must speak a compatible version |
| 132 | * of that protocol for it to be advertised as available. */ |
| 133 | static void check_sub_protocol(void) |
| 134 | { |
| 135 | const char *dot; |
| 136 | int their_protocol, their_sub; |
| 137 | int our_sub = get_subprotocol_version(); |
| 138 | |
| 139 | /* client_info starts with VER.SUB string if client is a pre-release. */ |
| 140 | if (!(their_protocol = atoi(client_info)) |
| 141 | || !(dot = strchr(client_info, '.')) |
| 142 | || !(their_sub = atoi(dot+1))) { |
| 143 | #if SUBPROTOCOL_VERSION != 0 |
| 144 | if (our_sub) |
| 145 | protocol_version--; |
| 146 | #endif |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | if (their_protocol < protocol_version) { |
| 151 | if (their_sub) |
| 152 | protocol_version = their_protocol - 1; |
| 153 | return; |
| 154 | } |
| 155 | |
| 156 | if (their_protocol > protocol_version) |
| 157 | their_sub = 0; /* 0 == final version of older protocol */ |
| 158 | if (their_sub != our_sub) |
| 159 | protocol_version--; |
| 160 | } |
| 161 | |
| 162 | void set_allow_inc_recurse(void) |
| 163 | { |
no test coverage detected