Skip to content

Commit

Permalink
trying to fix connection hang after download
Browse files Browse the repository at this point in the history
  • Loading branch information
UldisRinkevichs committed Jul 26, 2018
1 parent 679fc0c commit 7e8e0fa
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions Source/ftpserv.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,6 @@ void *list_thread(PFTPCONTEXT context)
gnutls_deinit(TLS_datasession);
}

if (clientsocket != INVALID_SOCKET)
close(clientsocket);

writelogentry(context, " LIST complete", "");

if (clientsocket == INVALID_SOCKET) {
Expand All @@ -694,6 +691,8 @@ void *list_thread(PFTPCONTEXT context)
sendstring(context, success226);
else
sendstring(context, error426);

close(clientsocket);
}

context->WorkerThreadValid = -1;
Expand Down Expand Up @@ -875,9 +874,6 @@ void *retr_thread(PFTPCONTEXT context)
gnutls_deinit(TLS_datasession);
}

if (clientsocket != INVALID_SOCKET)
close(clientsocket);

/* calculating performance */
dtx = lt1 - lt0;

Expand All @@ -896,6 +892,8 @@ void *retr_thread(PFTPCONTEXT context)
sendstring(context, success226);
else
sendstring(context, error426);

close(clientsocket);
}

context->WorkerThreadValid = -1;
Expand Down Expand Up @@ -1304,9 +1302,6 @@ void *stor_thread(PFTPCONTEXT context)
gnutls_deinit(TLS_datasession);
}

if (clientsocket != INVALID_SOCKET)
close(clientsocket);

/* calculating performance */
if (buffer != NULL)
{
Expand All @@ -1325,6 +1320,8 @@ void *stor_thread(PFTPCONTEXT context)
sendstring(context, success226);
else
sendstring(context, error426);

close(clientsocket);
}

context->WorkerThreadValid = -1;
Expand Down Expand Up @@ -1461,9 +1458,6 @@ void *append_thread(PFTPCONTEXT context)
gnutls_deinit(TLS_datasession);
}

if (clientsocket != INVALID_SOCKET)
close(clientsocket);

writelogentry(context, " STOR complete", "");

if (clientsocket == INVALID_SOCKET) {
Expand All @@ -1474,6 +1468,8 @@ void *append_thread(PFTPCONTEXT context)
sendstring(context, success226);
else
sendstring(context, error426);

close(clientsocket);
}

context->WorkerThreadValid = -1;
Expand Down Expand Up @@ -1752,9 +1748,6 @@ void *msld_thread(PFTPCONTEXT context)
gnutls_deinit(TLS_datasession);
}

if (clientsocket != INVALID_SOCKET)
close(clientsocket);

writelogentry(context, " LIST complete", "");

if (clientsocket == INVALID_SOCKET) {
Expand All @@ -1765,6 +1758,8 @@ void *msld_thread(PFTPCONTEXT context)
sendstring(context, success226);
else
sendstring(context, error426);

close(clientsocket);
}

context->WorkerThreadValid = -1;
Expand Down

0 comments on commit 7e8e0fa

Please sign in to comment.