gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r3067 - in freeway: native src/org/gnu/freeway/util/net


From: mdonoughe
Subject: [GNUnet-SVN] r3067 - in freeway: native src/org/gnu/freeway/util/net
Date: Mon, 26 Jun 2006 13:35:11 -0700 (PDT)

Author: mdonoughe
Date: 2006-06-26 13:35:08 -0700 (Mon, 26 Jun 2006)
New Revision: 3067

Modified:
   freeway/native/org_gnu_freeway_server_CPluginLoader.c
   freeway/src/org/gnu/freeway/util/net/CSNativeMessage.java
Log:
now almost compatible with gnunet-stats


Modified: freeway/native/org_gnu_freeway_server_CPluginLoader.c
===================================================================
--- freeway/native/org_gnu_freeway_server_CPluginLoader.c       2006-06-26 
20:15:20 UTC (rev 3066)
+++ freeway/native/org_gnu_freeway_server_CPluginLoader.c       2006-06-26 
20:35:08 UTC (rev 3067)
@@ -618,9 +618,9 @@
   
   GNUNET_ASSERT(handle != NULL);
   GNUNET_ASSERT(message != NULL);
-  GNUNET_ASSERT(message->size >= 4);
-fprintf(stderr, "jsendToClient %02x %02x %02x %02x\n", ((char *) message)[0] & 
0xff, ((char *) message)[1] & 0xff, ((char *) message)[2] & 0xff, ((char *) 
message)[3] & 0xff);
-fprintf(stderr, "packet is %d bytes long\n", message->size);
+  GNUNET_ASSERT(htons(message->size) >= 4);
+//fprintf(stderr, "jsendToClient %02x %02x %02x %02x\n", ((char *) message)[0] 
& 0xff, ((char *) message)[1] & 0xff, ((char *) message)[2] & 0xff, ((char *) 
message)[3] & 0xff);
+//fprintf(stderr, "packet is %d bytes long\n", htons(message->size));
   t = findThread();
   env = t->env;
   GNUNET_ASSERT(env != NULL);
@@ -629,9 +629,9 @@
   GNUNET_ASSERT(capiClazz != NULL);
   method = (*env)->GetMethodID(env, capiClazz, "sendToClient", 
"(Lorg/gnu/freeway/util/net/CSSession;[B)Lorg/gnu/freeway/cwrappers/CInt;");
   GNUNET_ASSERT(method != NULL);
-  jarray = (*env)->NewByteArray(env, message->size);
+  jarray = (*env)->NewByteArray(env, htons(message->size));
   GNUNET_ASSERT(jarray != NULL);
-  (*env)->SetByteArrayRegion(env, jarray, 0, message->size, (char*) message);
+  (*env)->SetByteArrayRegion(env, jarray, 0, htons(message->size), (char*) 
message);
   ok = (*env)->CallObjectMethod(env, t->jcapi, method, handle, jarray);
 (*env)->ExceptionDescribe(env);
   GNUNET_ASSERT(ok != NULL);
@@ -899,9 +899,9 @@
   char * adata = (*env)->GetByteArrayElements(env, data, NULL);
   GNUNET_ASSERT(adata != NULL);
   
-fprintf(stderr, "calling %x to handle a packet\n", fptr);
-fprintf(stderr, "cCallCallCSHandle %02x %02x %02x %02x\n", adata[0] & 0xff, 
adata[1] & 0xff, adata[2] & 0xff, adata[3] & 0xff);
-fprintf(stderr, "packet is %d bytes long\n", ((CS_MESSAGE_HEADER *) 
adata)->size);
+//fprintf(stderr, "calling %x to handle a packet\n", fptr);
+//fprintf(stderr, "cCallCallCSHandle %02x %02x %02x %02x\n", adata[0] & 0xff, 
adata[1] & 0xff, adata[2] & 0xff, adata[3] & 0xff);
+//fprintf(stderr, "packet is %d bytes long\n", htons(((CS_MESSAGE_HEADER *) 
adata)->size));
   ok = ((CSHandler) (void*) (long)fptr)((ClientHandle) (long) session, 
(CS_MESSAGE_HEADER *) adata);
   (*env)->ReleaseByteArrayElements(env, data, adata, 0);
   unregisterThread();

Modified: freeway/src/org/gnu/freeway/util/net/CSNativeMessage.java
===================================================================
--- freeway/src/org/gnu/freeway/util/net/CSNativeMessage.java   2006-06-26 
20:15:20 UTC (rev 3066)
+++ freeway/src/org/gnu/freeway/util/net/CSNativeMessage.java   2006-06-26 
20:35:08 UTC (rev 3067)
@@ -34,7 +34,7 @@
 
        public String toString()
        {
-               return "lame hack: NativeMessage "+ hex(arr[0]) + " " + 
hex(arr[1]) + " " + hex(arr[2]) + " " + hex(arr[3]) + "\njpacket is " + 
arr.length + " bytes long";
+               return "CSNativeMessage"; //+ hex(arr[0]) + " " + hex(arr[1]) + 
" " + hex(arr[2]) + " " + hex(arr[3]) + "\njpacket is " + arr.length + " bytes 
long";
        }
 
 
@@ -58,21 +58,21 @@
                
                arr = new byte[size];
                buf.get(arr);
-               System.err.println("CSNativeMessage readBytes " + hex(arr[0]) + 
" " + hex(arr[1]) + " " + hex(arr[2]) + " " + hex(arr[3]));
-               System.err.println("jpacket is " + size + " bytes long");
+               //System.err.println("CSNativeMessage readBytes " + hex(arr[0]) 
+ " " + hex(arr[1]) + " " + hex(arr[2]) + " " + hex(arr[3]));
+               //System.err.println("jpacket is " + size + " bytes long");
        }
        
-       private String hex(byte in) {
+       /*private String hex(byte in) {
                String[] l = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", 
"a", "b", "c", "d", "e", "f"};
                byte a = (byte) ((in & 0xff) / 16);
                byte b = (byte) ((in & 0xff) % 16);
                return l[a] + l[b];
-       }
+       }*/
 
        public void writeBytes( ByteBuffer buf )
        {
                buf.put(arr);
-               System.err.println("CSNativeMessage writeBytes " + hex(arr[0]) 
+ " " + hex(arr[1]) + " " + hex(arr[2]) + " " + hex(arr[3]));
-               System.err.println("jpacket is " + arr.length + " bytes long");
+               /*System.err.println("CSNativeMessage writeBytes " + 
hex(arr[0]) + " " + hex(arr[1]) + " " + hex(arr[2]) + " " + hex(arr[3]));
+               System.err.println("jpacket is " + arr.length + " bytes 
long");*/
        }
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]