agent: avoid double SSL_free(), SSL_shutdown() only when needed
This commit is contained in:
@@ -83,7 +83,8 @@ static void signal_handler(int sig)
|
||||
static void agent_shutdown(void)
|
||||
{
|
||||
printf("Shutting down agent...\n");
|
||||
if (ssl) SSL_shutdown(ssl);
|
||||
if (ssl && !SSL_get_shutdown(ssl))
|
||||
SSL_shutdown(ssl);
|
||||
if (ssl) SSL_free(ssl);
|
||||
if (ctx) SSL_CTX_free(ctx); /* release context */
|
||||
close(server); /* close socket */
|
||||
@@ -283,9 +284,6 @@ int main(int count, char *strings[])
|
||||
memcpy(&args[index].buf, &buf, sizeof(struct msg_t));
|
||||
}
|
||||
}
|
||||
|
||||
SSL_shutdown(ssl);
|
||||
SSL_free(ssl); /* release connection state */
|
||||
} while (bytes);
|
||||
if (SSL_get_shutdown(ssl)) {
|
||||
printf("RMPS server has shutdown, trying to reconnect...\n");
|
||||
|
||||
Reference in New Issue
Block a user