Răsfoiți Sursa

android build script

OlehKulykov 10 ani în urmă
părinte
comite
2beaac19f0

+ 28 - 0
builds/android/jni/Android.mk

@@ -0,0 +1,28 @@
+LOCAL_PATH:= $(call my-dir)
+
+
+ALL_SOURCES := \
+	../../../src/common.c \
+	../../../src/error.c \
+	../../../src/frame.c \
+	../../../src/librws.c \
+	../../../src/list.c \
+	../../../src/memory.c \
+	../../../src/socketpriv.c \
+	../../../src/socketpub.c \
+	../../../src/string.c \
+	../../../src/thread.c
+
+
+ALL_INCLUDES := $(LOCAL_PATH)/../../../
+
+ALL_CFLAGS := -w
+
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(ALL_SOURCES)
+LOCAL_C_INCLUDES += $(ALL_INCLUDES)
+LOCAL_CFLAGS += $(ALL_CFLAGS)
+LOCAL_MODULE := librws
+LOCAL_LDLIBS += -llog
+include $(BUILD_SHARED_LIBRARY)
+

+ 3 - 0
builds/android/jni/Application.mk

@@ -0,0 +1,3 @@
+APP_OPTIM := release
+APP_PLATFORM := android-14
+APP_ABI := all

+ 2 - 2
src/frame.c

@@ -36,8 +36,8 @@ _rws_frame * rws_frame_create_with_recv_data(const void * data, const size_t dat
 		const unsigned char * udata = (const unsigned char *)data;
 
 		const rws_opcode opcode = (rws_opcode)(udata[0] & 0x0f);
-		unsigned int is_fin = (udata[0] >> 7) & 0x01;
-		unsigned int is_masked = (udata[1] >> 7) & 0x01;
+		const unsigned int is_fin = (udata[0] >> 7) & 0x01;
+		const unsigned int is_masked = (udata[1] >> 7) & 0x01;
 		const unsigned int payload = udata[1] & 0x7f;
 		unsigned int header_size = is_masked ? 6 : 2;
 

+ 2 - 2
src/socket.h

@@ -65,13 +65,13 @@ typedef struct _rws_socket_struct
 	char * host;
 	char * path;
 
-	char * sec_ws_accept; //
+	char * sec_ws_accept; // "Sec-WebSocket-Accept" field from handshake
 
 	rws_thread work_thread;
 
 	int command;
 
-	rws_bool is_connected; //
+	rws_bool is_connected; // sock connected + handshake done
 
 	void * user_object;
 	rws_on_socket on_connected;

+ 3 - 3
src/socketpriv.c

@@ -85,15 +85,15 @@ rws_bool rws_socket_recv(_rws_socket * s)
 {
 	int is_reading = 1, error_number = -1, len = -1;
 	char * received = NULL;
-	size_t buff_size = 64, total_len = 0;
-	char buff[64];
+	size_t total_len = 0;
+	char buff[8192];
 
 	rws_error_delete_clean(&s->error);
 	s->received_len = 0;
 
 	while (is_reading)
 	{
-		len = recv(s->socket, buff, buff_size, 0);
+		len = recv(s->socket, buff, 8192, 0);
 		if (len > 0)
 		{
 			total_len += len;

+ 1 - 2
src/thread.c

@@ -114,8 +114,7 @@ rws_thread rws_thread_create(rws_thread_funct thread_function, void * user_objec
 {
 	_rws_thread * t = NULL;
 	int res = -1;
-#if defined(RWS_OS_WINDOWS)
-#else
+#if !defined(RWS_OS_WINDOWS)
 	pthread_attr_t attr;
 #endif
 

BIN
test/librws_test.xcodeproj/project.xcworkspace/xcuserdata/residentevil.xcuserdatad/UserInterfaceState.xcuserstate


+ 0 - 32
test/librws_test.xcodeproj/xcuserdata/residentevil.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -3,38 +3,6 @@
    type = "1"
    version = "2.0">
    <Breakpoints>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "../src/socketpriv.c"
-            timestampString = "475114698.054054"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "133"
-            endingLineNumber = "133"
-            landmarkName = "rws_socket_idle_recv()"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "../src/socketpriv.c"
-            timestampString = "475115835.468291"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "113"
-            endingLineNumber = "113"
-            landmarkName = "rws_socket_recv()"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent