aboutsummaryrefslogtreecommitdiff
path: root/tcpserver.c
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2010-03-24 12:09:57 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2010-03-24 12:09:57 +0000
commit1af905631bc3970cc8cee3ec795da3ea40f97144 (patch)
treec86b435780c67b9e827a98838dd7b3737dc87498 /tcpserver.c
parentd32fcfc1923200c7adead0e04c4ffdbc35142197 (diff)
kind of works now: we can dump about 500MB within 5secs into tcpserver on lo
svn path=/trunk/externals/iem/iemnet/; revision=13251
Diffstat (limited to 'tcpserver.c')
-rw-r--r--tcpserver.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/tcpserver.c b/tcpserver.c
index ba62ef8..9dcf529 100644
--- a/tcpserver.c
+++ b/tcpserver.c
@@ -100,7 +100,7 @@ static void tcpserver_send_bytes(t_tcpserver *x, int sockfd, t_iemnet_chunk*chun
#ifdef SIOCOUTQ
static int tcpserver_send_buffer_avaliable_for_client(t_tcpserver *x, int client);
#endif
-static void tcpserver_datacallback(t_tcpserver *x, int sockfd, t_iemnet_chunk*chunk);
+static void tcpserver_datacallback(t_tcpserver *x, int sockfd, int argc, t_atom*argv);
static void tcpserver_disconnect_client(t_tcpserver *x, t_floatarg fclient);
static void tcpserver_disconnect_socket(t_tcpserver *x, t_floatarg fsocket);
@@ -330,29 +330,24 @@ static void tcpserver_disconnect_socket(t_tcpserver *x, t_floatarg fsocket)
tcpserver_disconnect_client(x, id+1);
}
-/* ---------------- main tcpserver (receive) stuff --------------------- */
-
-static void tcpserver_datacallback(t_tcpserver *x, int sockfd, t_iemnet_chunk*chunk) {
- post("data callback for %x with data @ %x", x, chunk);
- if(NULL!=chunk) {
- t_atom*argv=NULL;
- const int size=chunk->size;
- post("\t%d elements", size);
- argv=iemnet__chunk2list(chunk);
- post("got list at %x", argv);
- outlet_list(x->x_msgout, &s_list, chunk->size, argv);
-
- post("freeing list");
- freebytes(argv, sizeof(t_atom)*chunk->size);
+/* ---------------- main tcpserver (receive) stuff --------------------- */
+static void tcpserver_datacallback(t_tcpserver *x, int sockfd, int argc, t_atom*argv) {
+ static int packetcount=0;
+ static int bytecount=0;
+ if(argc) {
+ outlet_list(x->x_msgout, &s_list, argc, argv);
+ packetcount++;
+ bytecount+=argc;
} else {
// disconnected
tcpserver_disconnect_socket(x, sockfd);
}
- post("callback done");
+
+ // post("tcpserver: %d bytes in %d packets", bytecount, packetcount);
}
static void tcpserver_connectpoll(t_tcpserver *x)