ithewei 4 anni fa
parent
commit
28a3a1e949
2 ha cambiato i file con 6 aggiunte e 6 eliminazioni
  1. 2 2
      .github/workflows/CI.yml
  2. 4 4
      event/hloop.h

+ 2 - 2
.github/workflows/CI.yml

@@ -36,12 +36,12 @@ jobs:
 
   build-windows:
     name: build-windows
-    runs-on: windows-2016
+    runs-on: windows-latest
     steps:
       - uses: actions/checkout@v2
       - name: build
         run: |
           mkdir win64
           cd win64
-          cmake .. -G "Visual Studio 15 2017 Win64"
+          cmake .. -G "Visual Studio 16 2019 Win64"
           cmake --build .

+ 4 - 4
event/hloop.h

@@ -411,8 +411,8 @@ HV_EXPORT hio_t* hio_setup_udp_upstream(hio_t* io, const char* host, int port);
 //-----------------unpack---------------------------------------------
 typedef enum {
     UNPACK_BY_FIXED_LENGTH  = 1,    // Not recommended
-    UNPACK_BY_DELIMITER     = 2,
-    UNPACK_BY_LENGTH_FIELD  = 3,    // Recommended
+    UNPACK_BY_DELIMITER     = 2,    // Suitable for text protocol
+    UNPACK_BY_LENGTH_FIELD  = 3,    // Suitable for binary protocol
 } unpack_mode_e;
 
 #define DEFAULT_PACKAGE_MAX_LENGTH  (1 << 21)   // 2M
@@ -422,7 +422,7 @@ typedef enum {
 
 // UNPACK_BY_LENGTH_FIELD
 typedef enum {
-    ENCODE_BY_VARINT        = 1,
+    ENCODE_BY_VARINT        = 17,               // 1 MSB + 7 bits
     ENCODE_BY_LITTEL_ENDIAN = LITTLE_ENDIAN,    // 1234
     ENCODE_BY_BIG_ENDIAN    = BIG_ENDIAN,       // 4321
 } unpack_coding_e;
@@ -453,8 +453,8 @@ typedef struct unpack_setting_s {
             unsigned short  body_offset;
             unsigned short  length_field_offset;
             unsigned short  length_field_bytes;
+                     short  length_adjustment;
             unpack_coding_e length_field_coding;
-            int             length_adjustment;
         };
     };
 #ifdef __cplusplus