summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2011-04-16 10:46:21 +0100
committerAndy Green <andy@warmcat.com>2011-04-16 10:46:21 +0100
commit72c34321d32207ec7ee2d3da2db82ba9755fb3c9 (patch)
tree0b2d541e7d4004074a914f6bf6be75ff01843c2c /lib
parent4b65a562a59ce79ec03a4d1720af8eedaeca5af9 (diff)
Revert Pavel's patch looping in recv
Signed-off-by: Andy Green <andy@warmcat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/client-handshake.c7
-rw-r--r--lib/libwebsockets.c19
2 files changed, 3 insertions, 23 deletions
diff --git a/lib/client-handshake.c b/lib/client-handshake.c
index 9b502cf..de306a6 100644
--- a/lib/client-handshake.c
+++ b/lib/client-handshake.c
@@ -34,7 +34,6 @@ libwebsocket_client_connect(struct libwebsocket_context *context,
{
struct hostent *server_hostent;
struct sockaddr_in server_addr;
- struct timeval tv;
char pkt[512];
struct pollfd pfd;
struct libwebsocket *wsi;
@@ -169,12 +168,6 @@ libwebsocket_client_connect(struct libwebsocket_context *context,
/* Disable Nagle */
setsockopt(wsi->sock, IPPROTO_TCP, TCP_NODELAY, &opt, sizeof(opt));
- /* Set receiving timeout */
- tv.tv_sec = 0;
- tv.tv_usec = 100 * 1000;
- setsockopt(wsi->sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv,
- sizeof(tv));
-
if (connect(wsi->sock, (struct sockaddr *)&server_addr,
sizeof(struct sockaddr)) == -1) {
fprintf(stderr, "Connect failed\n");
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 4d7b3d3..05f7a40 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -614,19 +614,7 @@ user_service:
return 0;
}
-static ssize_t
-libwebsocket_recv(int sock, void *buf, size_t len, int flags)
-{
- int n, ret = 0;
-
- while ((len > 0) && (n = recv(sock, (char *)buf + ret, len,
- flags)) > 0) {
- ret += n;
- len -= n;
- }
- return ret;
-}
/**
* libwebsocket_service_fd() - Service polled socket with something waiting
@@ -1020,7 +1008,7 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
return 1;
}
- n = libwebsocket_recv(wsi->sock, pkt, sizeof pkt, 0);
+ n = recv(wsi->sock, pkt, sizeof pkt, 0);
if (n < 0) {
libwebsocket_close_and_free_session(context, wsi,
LWS_CLOSE_STATUS_NOSTATUS);
@@ -1364,7 +1352,7 @@ issue_hdr:
len = SSL_read(wsi->ssl, pkt, sizeof pkt);
else
#endif
- len = libwebsocket_recv(wsi->sock, pkt, sizeof pkt, 0);
+ len = recv(wsi->sock, pkt, sizeof pkt, 0);
if (len < 0) {
fprintf(stderr,
@@ -1749,8 +1737,7 @@ bail2:
else
#endif
eff_buf.token_len =
- libwebsocket_recv(pollfd->fd, buf,
- sizeof buf, 0);
+ recv(pollfd->fd, buf, sizeof buf, 0);
if (eff_buf.token_len < 0) {
fprintf(stderr, "Socket read returned %d\n",