1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

curl_socket_t mistakes cleanup

This commit is contained in:
Daniel Stenberg 2004-03-10 16:01:47 +00:00
parent 85838a8966
commit 7225b14002
7 changed files with 18 additions and 14 deletions

View File

@ -750,7 +750,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
fd_set readfd; fd_set readfd;
char *line_start; char *line_start;
char *host_port; char *host_port;
int tunnelsocket = conn->sock[sockindex]; curl_socket_t tunnelsocket = conn->sock[sockindex];
#define SELECT_OK 0 #define SELECT_OK 0
#define SELECT_ERROR 1 #define SELECT_ERROR 1

View File

@ -279,8 +279,8 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle,
FD_SET(sockfd, write_fd_set); FD_SET(sockfd, write_fd_set);
} }
if(sockfd > *max_fd) if((int)sockfd > *max_fd)
*max_fd = sockfd; *max_fd = (int)sockfd;
} }
break; break;
case CURLM_STATE_PERFORM: case CURLM_STATE_PERFORM:

View File

@ -23,7 +23,8 @@
* $Id$ * $Id$
***************************************************************************/ ***************************************************************************/
CURLcode Curl_sendf(int fd, struct connectdata *, const char *fmt, ...); CURLcode Curl_sendf(curl_socket_t sockfd, struct connectdata *,
const char *fmt, ...);
void Curl_infof(struct SessionHandle *, const char *fmt, ...); void Curl_infof(struct SessionHandle *, const char *fmt, ...);
void Curl_failf(struct SessionHandle *, const char *fmt, ...); void Curl_failf(struct SessionHandle *, const char *fmt, ...);
@ -42,7 +43,8 @@ int Curl_read(struct connectdata *conn, curl_socket_t sockfd,
char *buf, size_t buffersize, char *buf, size_t buffersize,
ssize_t *n); ssize_t *n);
/* internal write-function, does plain socket, SSL and krb4 */ /* internal write-function, does plain socket, SSL and krb4 */
CURLcode Curl_write(struct connectdata *conn, int sockfd, CURLcode Curl_write(struct connectdata *conn,
curl_socket_t sockfd,
void *mem, size_t len, void *mem, size_t len,
ssize_t *written); ssize_t *written);

View File

@ -23,7 +23,7 @@
* $Id$ * $Id$
***************************************************************************/ ***************************************************************************/
#include "urldata.h" #include "urldata.h"
CURLcode Curl_SSLConnect(struct connectdata *conn, curl_socket_t sockfd); CURLcode Curl_SSLConnect(struct connectdata *conn, int sockindex);
void Curl_SSL_init(void); /* Global SSL init */ void Curl_SSL_init(void); /* Global SSL init */
void Curl_SSL_cleanup(void); /* Global SSL cleanup */ void Curl_SSL_cleanup(void); /* Global SSL cleanup */

View File

@ -1368,7 +1368,10 @@ void Curl_single_fdset(struct connectdata *conn,
} }
if(conn->keep.keepon & KEEP_WRITE) { if(conn->keep.keepon & KEEP_WRITE) {
FD_SET(conn->writesockfd, write_fd_set); FD_SET(conn->writesockfd, write_fd_set);
if(conn->writesockfd > *max_fd)
/* since sockets are curl_socket_t nowadays, we typecast it to int here
to compare it nicely */
if((int)conn->writesockfd > *max_fd)
*max_fd = conn->writesockfd; *max_fd = conn->writesockfd;
conn->keep.writefdp = write_fd_set; /* store the address of the set */ conn->keep.writefdp = write_fd_set; /* store the address of the set */
} }

View File

@ -37,14 +37,13 @@ CURLcode Curl_readwrite_init(struct connectdata *conn);
/* This sets up a forthcoming transfer */ /* This sets up a forthcoming transfer */
CURLcode CURLcode
Curl_Transfer (struct connectdata *data, Curl_Transfer (struct connectdata *data,
curl_socket_t sockfd, /* socket to read from or int sockindex, /* socket index to read from or -1 */
CURL_SOCKET_BAD */
curl_off_t size, /* -1 if unknown at this point */ curl_off_t size, /* -1 if unknown at this point */
bool getheader, /* TRUE if header parsing is wanted */ bool getheader, /* TRUE if header parsing is wanted */
curl_off_t *bytecountp, /* return number of bytes read */ curl_off_t *bytecountp, /* return number of bytes read */
curl_socket_t writesockfd, /* socket to write to, it may very int writesockindex, /* socket index to write to, it may
well be the same we read from. very well be the same we read from.
CURL_SOCKET_BAD disables */ -1 disables */
curl_off_t *writecountp /* return number of bytes written */ curl_off_t *writecountp /* return number of bytes written */
); );
#endif #endif

View File

@ -1378,7 +1378,7 @@ CURLcode Curl_disconnect(struct connectdata *conn)
* be dead. Most commonly this happens when the server has closed the * be dead. Most commonly this happens when the server has closed the
* connection due to inactivity. * connection due to inactivity.
*/ */
static bool SocketIsDead(int sock) static bool SocketIsDead(curl_socket_t sock)
{ {
int sval; int sval;
bool ret_val = TRUE; bool ret_val = TRUE;
@ -1386,7 +1386,7 @@ static bool SocketIsDead(int sock)
struct timeval to; struct timeval to;
FD_ZERO(&check_set); FD_ZERO(&check_set);
FD_SET(sock,&check_set); FD_SET(sock, &check_set);
to.tv_sec = 0; to.tv_sec = 0;
to.tv_usec = 0; to.tv_usec = 0;