Explicitly close the TLS connection

Just to be nice.
master
C. McEnroe 2020-02-13 01:01:23 -05:00
parent 9bed890aa8
commit 0a772ff139
3 changed files with 8 additions and 0 deletions

1
chat.c
View File

@ -269,5 +269,6 @@ int main(int argc, char *argv[]) {
}; };
handle(msg); handle(msg);
ircClose();
uiHide(); uiHide();
} }

1
chat.h
View File

@ -130,6 +130,7 @@ void ircRecv(void);
void ircSend(const char *ptr, size_t len); void ircSend(const char *ptr, size_t len);
void ircFormat(const char *format, ...) void ircFormat(const char *format, ...)
__attribute__((format(printf, 1, 2))); __attribute__((format(printf, 1, 2)));
void ircClose(void);
extern struct Replies { extern struct Replies {
size_t join; size_t join;

6
irc.c
View File

@ -273,3 +273,9 @@ void ircRecv(void) {
len -= line - buf; len -= line - buf;
memmove(buf, line, len); memmove(buf, line, len);
} }
void ircClose(void) {
int error = tls_close(client);
if (error) errx(EX_IOERR, "tls_close: %s", tls_error(client));
tls_free(client);
}