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)
|
static void agent_shutdown(void)
|
||||||
{
|
{
|
||||||
printf("Shutting down agent...\n");
|
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 (ssl) SSL_free(ssl);
|
||||||
if (ctx) SSL_CTX_free(ctx); /* release context */
|
if (ctx) SSL_CTX_free(ctx); /* release context */
|
||||||
close(server); /* close socket */
|
close(server); /* close socket */
|
||||||
@@ -283,9 +284,6 @@ int main(int count, char *strings[])
|
|||||||
memcpy(&args[index].buf, &buf, sizeof(struct msg_t));
|
memcpy(&args[index].buf, &buf, sizeof(struct msg_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SSL_shutdown(ssl);
|
|
||||||
SSL_free(ssl); /* release connection state */
|
|
||||||
} while (bytes);
|
} while (bytes);
|
||||||
if (SSL_get_shutdown(ssl)) {
|
if (SSL_get_shutdown(ssl)) {
|
||||||
printf("RMPS server has shutdown, trying to reconnect...\n");
|
printf("RMPS server has shutdown, trying to reconnect...\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user