1 --- module-newcamd.c.orig 2008-12-12 20:17:14.000000000 +0200
2 +++ module-newcamd.c 2009-02-03 14:30:31.000000000 +0200
6 -#define CWS_NETMSGSIZE 256
7 +#define CWS_NETMSGSIZE 256+3
9 typedef unsigned char uint8;
10 typedef unsigned short uint16;
13 netbuf[0] = (len - 2) >> 8;
14 netbuf[1] = (len - 2) & 0xff;
15 - return send(handle, netbuf, len, 0);
16 + len=send(handle, netbuf, len, 0);
17 + cs_debug("nms: send len=%d", len);
21 static int network_message_receive(int handle, uint16 *netMsgId, uint8 *buffer,
23 if (!buffer || handle < 0)
25 len = recv(handle, netbuf, 2, 0);
26 - cs_debug("nmr(): len=%d, errno=%d", len, (len==-1)?errno:0);
27 + cs_debug("nmr(): len=%d, errno=%d, netbuf=(%X|%X)->(%X), %d > %d",
28 + len, (len==-1)?errno:0,netbuf[0],netbuf[1],(netbuf[0] << 8),
29 + ((netbuf[0] << 8) | netbuf[1]),(CWS_NETMSGSIZE - 2));
31 cs_debug("nmr: 1 return 0");
32 network_tcp_connection_close(handle);
34 network_tcp_connection_close(handle);
37 - if (((netbuf[0] << 8) | netbuf[1]) > CWS_NETMSGSIZE - 2) {
38 - cs_debug("nmr: 1 return -1");
39 + if (((netbuf[0] << 8) | netbuf[1]) > CWS_NETMSGSIZE - 2
40 + /*&& (netbuf[0] << 8)<=256*/ ) {
41 + cs_debug("nmr: 1 return -1, (%X | %X)",(netbuf[0] << 8) ,netbuf[1]);
46 cs_debug("nmr: 2 return 0");
49 + cs_debug("nmr(): 2 len=%d", len);
50 if (len != ((netbuf[0] << 8) | netbuf[1])) {
51 - cs_debug("nmr: 2 return -1");
52 + cs_debug("nmr: 2 return -1, (%X | %X)",(netbuf[0] << 8) ,netbuf[1]);