This is provided by <limits.h> on all platforms as long as _XOPEN_SOURCE
is defined. On Linux, this is 1024, on Solaris, this is 16, and on any
other platform, we now respect the value supported by the OS.

Signed-off-by: Dan McGee <dpmc...@gmail.com>
---
 server/main_channel.c |    2 --
 server/red_channel.c  |    2 +-
 server/red_channel.h  |   11 ++++++++---
 server/snd_worker.c   |    9 ++++++---
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/server/main_channel.c b/server/main_channel.c
index f7e1ab0..4d1f8ea 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -47,8 +47,6 @@
 
 #define ZERO_BUF_SIZE 4096
 
-#define REDS_MAX_SEND_IOVEC 100
-
 #define NET_TEST_WARMUP_BYTES 0
 #define NET_TEST_BYTES (1024 * 250)
 
diff --git a/server/red_channel.c b/server/red_channel.c
index c07216e..beffa68 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -329,7 +329,7 @@ static void red_channel_client_peer_prepare_out_msg(
     RedChannelClient *rcc = (RedChannelClient *)opaque;
 
     *vec_size = spice_marshaller_fill_iovec(rcc->send_data.marshaller,
-                                            vec, MAX_SEND_VEC, pos);
+                                            vec, IOV_MAX, pos);
 }
 
 static void red_channel_client_peer_on_out_block(void *opaque)
diff --git a/server/red_channel.h b/server/red_channel.h
index 7bafecb..41f9b25 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -22,17 +22,22 @@
 #ifndef _H_RED_CHANNEL
 #define _H_RED_CHANNEL
 
-#include "red_common.h"
 #include <pthread.h>
+#include <limits.h>
+
+#include "red_common.h"
 #include "spice.h"
 #include "ring.h"
 #include "common/marshaller.h"
 #include "server/demarshallers.h"
 
 #define MAX_SEND_BUFS 1000
-#define MAX_SEND_VEC 100
 #define CLIENT_ACK_WINDOW 20
 
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
+
 #define MAX_HEADER_SIZE sizeof(SpiceDataHeader)
 
 /* Basic interface for channels, without using the RedChannel interface.
@@ -109,7 +114,7 @@ typedef struct OutgoingHandlerInterface {
 typedef struct OutgoingHandler {
     OutgoingHandlerInterface *cb;
     void *opaque;
-    struct iovec vec_buf[MAX_SEND_VEC];
+    struct iovec vec_buf[IOV_MAX];
     int vec_size;
     struct iovec *vec;
     int pos;
diff --git a/server/snd_worker.c b/server/snd_worker.c
index 0e93a6f..aa1ceb7 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -21,6 +21,7 @@
 
 #include <fcntl.h>
 #include <errno.h>
+#include <limits.h>
 #include <sys/socket.h>
 #include <netinet/ip.h>
 #include <netinet/tcp.h>
@@ -36,7 +37,9 @@
 #include "generated_marshallers.h"
 #include "demarshallers.h"
 
-#define MAX_SEND_VEC 100
+#ifndef IOV_MAX
+#define IOV_MAX 1024
+#endif
 
 #define RECIVE_BUF_SIZE (16 * 1024 * 2)
 
@@ -262,7 +265,7 @@ static int snd_send_data(SndChannel *channel)
     }
 
     for (;;) {
-        struct iovec vec[MAX_SEND_VEC];
+        struct iovec vec[IOV_MAX];
         int vec_size;
 
         if (!n) {
@@ -276,7 +279,7 @@ static int snd_send_data(SndChannel *channel)
         }
 
         vec_size = spice_marshaller_fill_iovec(channel->send_data.marshaller,
-                                               vec, MAX_SEND_VEC, 
channel->send_data.pos);
+                                               vec, IOV_MAX, 
channel->send_data.pos);
         n = reds_stream_writev(channel->stream, vec, vec_size);
         if (n == -1) {
             switch (errno) {
-- 
1.7.9.1

_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to