Skip to content
Merged
merged 7 commits into from
May 25, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mxshadowsrv: Avoid redundant error messages
  • Loading branch information
donald committed May 23, 2021
commit 8693da8beb31c4abf8b33515dcc8b97d528fe2ea
14 changes: 3 additions & 11 deletions mxshadowsrv.c
Original file line number Diff line number Diff line change
@@ -152,18 +152,13 @@ static void process_client(int socket) {
if (ssl == NULL) { psslerror("SSL_new"); return; }
SSL_set_fd(ssl, socket);
if (ssl_accept_with_timeout(ssl, socket, TIMEOUT) <= 0) {
perror("accept");
return;
}

char buf[64];
int len = ssl_read_with_timeout(ssl, socket, buf, sizeof(buf), TIMEOUT);
if (len == 0)
if (len <= 0 )
return;
if (len < 0) {
perror("read");
return;
}
if (len == sizeof(buf)) {
fprintf(stderr, "identifier to long\n");
SSL_shutdown(ssl);
@@ -180,11 +175,8 @@ static void process_client(int socket) {
status = pthread_mutex_unlock(&shadow_mutex);
if (status != 0) { errno = status; perror("pthread_mutex_unlock"); exit(1);}

if (line_len) {
int status = ssl_write_with_timeout(ssl, socket, line, line_len, TIMEOUT);
if (status == -1)
perror("write");
}
if (line_len)
ssl_write_with_timeout(ssl, socket, line, line_len, TIMEOUT);
SSL_shutdown(ssl);
}