Author: mturk
Date: Wed Jul 13 10:01:40 2011
New Revision: 1145939
URL: http://svn.apache.org/viewvc?rev=1145939&view=rev
Log:
Fix typos
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/win32/localsock.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/localsock.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/localsock.c?rev=1145939&r1=1145938&r2=1145939&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/localsock.c
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/localsock.c Wed Jul
13 10:01:40 2011
@@ -264,21 +264,34 @@ ACR_NET_EXPORT(jint, LocalEndpoint, conn
sa.sin_port = htons((u_short)port);
sa.sin_family = AF_INET;
sa.sin_addr.s_addr = inet_addr("127.0.0.1");
+ if (timeout == 0)
+ timeout = wd->fd.timeout;
+ if (timeout > 0 && (wd->fd.flags & ACR_DT_NONBLOCK) == 0) {
+ /* Turn the socket to non-blocking mode
+ * for the duration of the connect call.
+ */
+ if ((rc = AcrNonblock(wd->fd.u.s, 1)) != 0)
+ return rc;
+ }
rc = connect(wd->fd.u.s, (SOCKADDR *)&sa, sas);
if (rc == SOCKET_ERROR)
rc = ACR_GET_NETOS_ERROR();
- if (rc != 0 && (wd->fd.type & ACR_DT_NBLOCK)) {
- if (timeout > 0 && (rc == WSAEINPROGRESS || rc == WSAEALREADY || rc ==
WSAEWOULDBLOCK)) {
- rc = AcrWaitIO(wd->fd.u.s, timeout, FD_WRITE);
- if (rc == 0) {
- int err;
- socklen_t len = sizeof(err);
- if (getsockopt(wd->fd.u.s, SOL_SOCKET, SO_ERROR, (char *)&err,
&len) == -1);
- rc = ACR_GET_NETOS_ERROR();
- if (err != 0)
- rc = err;
+ if (rc != 0) {
+ if (timeout > 0) {
+ if (rc == WSAEINPROGRESS || rc == WSAEALREADY || rc ==
WSAEWOULDBLOCK) {
+ rc = AcrWaitIO(wd->fd.u.s, timeout, FD_WRITE);
+ if (rc == 0) {
+ int err;
+ socklen_t len = sizeof(err);
+ if (getsockopt(wd->fd.u.s, SOL_SOCKET, SO_ERROR, (char
*)&err, &len) == -1);
+ rc = ACR_GET_NETOS_ERROR();
+ if (err != 0)
+ rc = err;
+ }
}
+ if ((wd->fd.type & ACR_DT_NONBLOCK) == 0)
+ AcrNonblock(wd->fd.u.s, 0);
}
}
return rc;
@@ -368,7 +381,6 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
acr_sockaddr_t *aa;
struct sockaddr_in sa;
int sas = ISIZEOF(sa);
- int type;
wls_fd_t *sp;
wls_fd_t *wd = J2P(fp, wls_fd_t *);
@@ -379,7 +391,7 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
ACR_THROW_NET_ERRNO();
return 0;
}
- if (block == JNI_FALSE && (type & ACR_DT_NBLOCK) == 0) {
+ if (block == JNI_FALSE && (wd->fd.flags & ACR_DT_NONBLOCK) == 0) {
int rc = AcrNonblock(sd, 1);
if (rc != 0) {
closesocket(sd);
@@ -402,7 +414,7 @@ ACR_NET_EXPORT(jlong, LocalServerEndpoin
SOCKADDR_RELEASE(ba, aa);
sp->fd.type = ACR_DT_LSOCK;
- sp->fd.flags = wd->fd.flags
+ sp->fd.flags = wd->fd.flags;
sp->fd.timeout = wd->fd.timeout;
sp->fd.refs = 1;
sp->fd.u.s = sd;
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c?rev=1145939&r1=1145938&r2=1145939&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c Wed Jul 13
10:01:40 2011
@@ -15,6 +15,7 @@
*/
#include "acr/time.h"
+#include "acr/jniapi.h"
#include "arch_opts.h"
acr_time_t