diff options
author | Martin Peach <mrpeach@users.sourceforge.net> | 2014-02-18 20:09:23 +0000 |
---|---|---|
committer | Martin Peach <mrpeach@users.sourceforge.net> | 2014-02-18 20:09:23 +0000 |
commit | bd4a686ede3ec35f024c76eec5b07d7f2334ffcd (patch) | |
tree | 4045c6a892545eecf7bea227f1364c74013134d1 /net | |
parent | b6bd4fb4475da960744ff6b169f89dbb859b0d9c (diff) |
More crash prevention in 64-bit
svn path=/trunk/externals/mrpeach/; revision=17267
Diffstat (limited to 'net')
-rw-r--r-- | net/tcpclient.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/net/tcpclient.c b/net/tcpclient.c index 98d6bec..f32f910 100644 --- a/net/tcpclient.c +++ b/net/tcpclient.c @@ -70,7 +70,7 @@ static char objName[] = "tcpclient"; typedef struct _tcpclient_sender_params { char x_sendbuf[MAX_TCPCLIENT_SEND_BUF]; /* possibly allocate this dynamically for space over speed */ - int x_buf_len; + size_t x_buf_len; int x_sendresult; pthread_t sendthreadid; int threadisvalid; /* non-zero if sendthreadid is an active thread */ @@ -383,8 +383,11 @@ static void *tcpclient_child_send(void *w) { t_tcpclient_sender_params *tsp = (t_tcpclient_sender_params*) w; - tsp->x_sendresult = send(tsp->x_x->x_fd, tsp->x_sendbuf, tsp->x_buf_len, 0); - clock_delay(tsp->x_x->x_sendclock, 0); // calls tcpclient_sent when it's safe to do so + if (tsp->x_x->x_fd >= 0) + { + tsp->x_sendresult = send(tsp->x_x->x_fd, tsp->x_sendbuf, tsp->x_buf_len, 0); + clock_delay(tsp->x_x->x_sendclock, 0); // calls tcpclient_sent when it's safe to do so + } tsp->threadisvalid = 0; /* this thread is over */ return(tsp); } |