- plenty of code cleanup (some refactoring of socket / UPNP code)

- FTP console output now only shows when --verbose used
This commit is contained in:
Mark Vejvoda
2010-12-31 08:21:26 +00:00
parent bd12b10e29
commit d176053da9
12 changed files with 198 additions and 291 deletions

View File

@@ -33,7 +33,6 @@
#pragma comment(lib, "MSWSOCK")
ip_t ownIp;
//ip_t ownExternalIp;
LOCAL fd_set watchedSockets;
LOCAL fd_set signaledSockets;
@@ -43,7 +42,6 @@ void ftpArchInit()
{
WSADATA wsaData;
ownIp = 0;
//ownExternalIp = externalIp;
maxSockNr = 0;
FD_ZERO(&watchedSockets);
WSAStartup(MAKEWORD(2, 0),&wsaData);
@@ -293,9 +291,6 @@ socket_t ftpEstablishDataConnection(int passive, ip_t *ip, port_t *port)
*port = ntohs(myAddr.sin_port);
*ip = ownIp;
//if(ownExternalIp > 0) {
// *ip = ownExternalIp;
//}
if(listen(dataSocket, 1))
{
@@ -376,16 +371,14 @@ socket_t ftpAcceptServerConnection(socket_t server, ip_t *remoteIP, port_t *remo
len = sizeof(sockinfo);
if(getsockname(clientSocket, (struct sockaddr *)&sockinfo, &len))
{
#if DBG_LOG
printf("getsockname error\n");
#endif
if(VERBOSE_MODE_ENABLED) printf("getsockname error\n");
}
ownIp = ntohl(sockinfo.sin_addr.s_addr); // eigene IP-Adresse abspeichern (wird dir PASV benätigt)
}
#if DBG_LOG
printf("Verbindung mit %s auf Port %d akzeptiert.\n", inet_ntoa(sockinfo.sin_addr), *remotePort);
#endif
if(VERBOSE_MODE_ENABLED) printf("Connection with %s on Port %d accepted.\n", inet_ntoa(sockinfo.sin_addr), *remotePort);
return clientSocket;
}