| 2264 | } |
| 2265 | |
| 2266 | void SIPpSocket::reset_connection() |
| 2267 | { |
| 2268 | if (!reconnect_allowed()) { |
| 2269 | ERROR_NO("Max number of reconnections reached"); |
| 2270 | } |
| 2271 | |
| 2272 | if (reset_number != -1) { |
| 2273 | reset_number--; |
| 2274 | } |
| 2275 | |
| 2276 | if (reset_close) { |
| 2277 | WARNING("Closing calls, because of TCP reset or close!"); |
| 2278 | close_calls(); |
| 2279 | } |
| 2280 | |
| 2281 | /* Sleep for some period of time before the reconnection. */ |
| 2282 | usleep(1000 * reset_sleep); |
| 2283 | |
| 2284 | if (reconnect() < 0) { |
| 2285 | WARNING_NO("Could not reconnect TCP socket"); |
| 2286 | close_calls(); |
| 2287 | } else { |
| 2288 | WARNING("Socket required a reconnection."); |
| 2289 | } |
| 2290 | } |
| 2291 | |
| 2292 | /* Close just those calls for a given socket (e.g., if the remote end closes |
| 2293 | * the connection. */ |
no test coverage detected