mirror of
https://github.com/wiiu-env/ftpiiu_plugin.git
synced 2024-12-28 13:21:47 +01:00
reduce dropped connections at end of transfer
This commit is contained in:
parent
c79616d2ef
commit
5617e2c32a
11
source/ftp.c
11
source/ftp.c
@ -295,6 +295,7 @@ ftp_closesocket(int fd,
|
||||
int rc;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
struct pollfd pollinfo;
|
||||
|
||||
if(connected)
|
||||
{
|
||||
@ -310,9 +311,17 @@ ftp_closesocket(int fd,
|
||||
inet_ntoa(addr.sin_addr), ntohs(addr.sin_port));
|
||||
|
||||
/* shutdown connection */
|
||||
rc = shutdown(fd, SHUT_RDWR);
|
||||
rc = shutdown(fd, SHUT_WR);
|
||||
if(rc != 0)
|
||||
console_print(RED "shutdown: %d %s\n" RESET, errno, strerror(errno));
|
||||
|
||||
/* wait for client to close connection */
|
||||
pollinfo.fd = fd;
|
||||
pollinfo.events = POLLIN;
|
||||
pollinfo.revents = 0;
|
||||
rc = poll(&pollinfo, 1, 250);
|
||||
if(rc < 0)
|
||||
console_print(RED "poll: %d %s\n" RESET, errno, strerror(errno));
|
||||
}
|
||||
|
||||
/* close socket */
|
||||
|
Loading…
Reference in New Issue
Block a user