Skip to content
Snippets Groups Projects
Commit 2d9744f9 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Feature/ws mask

parent c8fd97b4
Branches
No related tags found
1 merge request!361Feature/ws mask
...@@ -8,14 +8,13 @@ variables: ...@@ -8,14 +8,13 @@ variables:
GIT_SUBMODULE_STRATEGY: recursive GIT_SUBMODULE_STRATEGY: recursive
CMAKE_ARGS_WINDOWS: '-DCMAKE_GENERATOR_PLATFORM=x64 -DCeres_DIR="C:/Program Files/Ceres" -DPORTAUDIO_INCLUDE_DIRS="C:/Build/src/portaudio/include" -DPORTAUDIO_LIBRARY="C:/Build/bin/portaudio/Release/portaudio_x64.lib" -DPYLON_DIR="C:/Program Files/Basler/pylon 6/Development" -DOpenCV_DIR="C:/Build/bin/opencv/install" -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2" -DWITH_OPENVR=TRUE -DWITH_CERES=TRUE' CMAKE_ARGS_WINDOWS: '-DCMAKE_GENERATOR_PLATFORM=x64 -DCeres_DIR="C:/Program Files/Ceres" -DPORTAUDIO_INCLUDE_DIRS="C:/Build/src/portaudio/include" -DPORTAUDIO_LIBRARY="C:/Build/bin/portaudio/Release/portaudio_x64.lib" -DPYLON_DIR="C:/Program Files/Basler/pylon 6/Development" -DOpenCV_DIR="C:/Build/bin/opencv/install" -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2" -DWITH_OPENVR=TRUE -DWITH_CERES=TRUE'
stages: #stages:
- all # - all
- deploy # - deploy
#### Linux #### Linux
linux: build:
stage: all
tags: tags:
- linux - linux
variables: variables:
...@@ -32,61 +31,61 @@ linux: ...@@ -32,61 +31,61 @@ linux:
- ninja - ninja
- ninja package - ninja package
- ctest --output-on-failure - ctest --output-on-failure
- cd ../SDK/Python # - cd ../SDK/Python
- python3 -m unittest discover test # - python3 -m unittest discover test
webserver-deploy: #webserver-deploy:
only: # only:
- master # - master
stage: deploy # stage: deploy
tags: # tags:
- linux # - linux
variables: # variables:
NODE_SERVER: '10.0.0.9' # NODE_SERVER: '10.0.0.9'
script: # script:
- npm install web-service # - npm install web-service
- browserify web-service/public/js/index.js -o web-service/public/js/bundle.js # - browserify web-service/public/js/index.js -o web-service/public/js/bundle.js
- rsync -vr --delete web-service/ nodejs@${NODE_SERVER}:/srv/nodejs/web-service # - rsync -vr --delete web-service/ nodejs@${NODE_SERVER}:/srv/nodejs/web-service
- ssh nodejs@${NODE_SERVER} -- "npm install web-service && pm2 restart web-service" # - ssh nodejs@${NODE_SERVER} -- "npm install web-service && pm2 restart web-service"
- doxygen # - doxygen
- rsync -vr --delete doc/ nodejs@${NODE_SERVER}:/srv/nodejs/doc # - rsync -vr --delete doc/ nodejs@${NODE_SERVER}:/srv/nodejs/doc
### Windows ### Windows
.build-windows: &build-windows #.build-windows: &build-windows
- call vcvars64.bat # - call vcvars64.bat
- mkdir build # - mkdir build
- cd build # - cd build
- cmake %CMAKE_ARGS% %CMAKE_ARGS_WINDOWS% -DREALSENSE_DIR="C:/Program Files (x86)/Intel RealSense SDK 2.0" -DOPENVR_DIR="C:/Program Files (x86)/OpenVRSDK" -DOPUS_DIR="C:/Program Files (x86)/Opus" .. # - cmake %CMAKE_ARGS% %CMAKE_ARGS_WINDOWS% -DREALSENSE_DIR="C:/Program Files (x86)/Intel RealSense SDK 2.0" -DOPENVR_DIR="C:/Program Files (x86)/OpenVRSDK" -DOPUS_DIR="C:/Program Files (x86)/Opus" ..
- devenv ftl.utu.fi.sln /build Release # - devenv ftl.utu.fi.sln /build Release
- rmdir /q /s "%DEPLOY_DIR%/%CI_COMMIT_REF_SLUG%" # - rmdir /q /s "%DEPLOY_DIR%/%CI_COMMIT_REF_SLUG%"
- mkdir "%DEPLOY_DIR%/%CI_COMMIT_REF_SLUG%" # - mkdir "%DEPLOY_DIR%/%CI_COMMIT_REF_SLUG%"
- 'copy "applications\vision\Release\voltu-vision.exe" "%DEPLOY_DIR%\%CI_COMMIT_REF_SLUG%"' # - 'copy "applications\vision\Release\voltu-vision.exe" "%DEPLOY_DIR%\%CI_COMMIT_REF_SLUG%"'
- 'copy "applications\gui2\Release\voltu-ui.exe" "%DEPLOY_DIR%\%CI_COMMIT_REF_SLUG%"' # - 'copy "applications\gui2\Release\voltu-ui.exe" "%DEPLOY_DIR%\%CI_COMMIT_REF_SLUG%"'
windows-vision: #windows-vision:
except: # except:
- master # - master
stage: all # stage: all
variables: # variables:
CMAKE_ARGS: '-DENABLE_PROFILER=TRUE -DWITH_OPTFLOW=TRUE -DBUILD_VISION=TRUE -DBUILD_CALIBRATION=FALSE -DBUILDRECONSTRUCT=FALSE -DBUILDRENDERER=FALSE -DBUILD_TESTING=FALSE -DBUILD_TESTS=FALSE' # CMAKE_ARGS: '-DENABLE_PROFILER=TRUE -DWITH_OPTFLOW=TRUE -DBUILD_VISION=TRUE -DBUILD_CALIBRATION=FALSE -DBUILDRECONSTRUCT=FALSE -DBUILDRENDERER=FALSE -DBUILD_TESTING=FALSE -DBUILD_TESTS=FALSE'
DEPLOY_DIR: 'C:/Shared/AutoDeploy' # DEPLOY_DIR: 'C:/Shared/AutoDeploy'
tags: # tags:
- win # - win
script: # script:
- *build-windows # - *build-windows
windows-master: #windows-master:
only: # only:
- master # - master
stage: all # stage: all
variables: # variables:
CMAKE_ARGS: '-DWITH_OPTFLOW=TRUE' # CMAKE_ARGS: '-DWITH_OPTFLOW=TRUE'
DEPLOY_DIR: 'C:/Shared/AutoDeploy' # DEPLOY_DIR: 'C:/Shared/AutoDeploy'
tags: # tags:
- win # - win
script: # script:
- *build-windows # - *build-windows
# - set PATH=%PATH%;C:/Shared/Deploy # - set PATH=%PATH%;C:/Shared/Deploy
# - ctest --output-on-failure --timeout 60 # - ctest --output-on-failure --timeout 60
...@@ -12,5 +12,5 @@ function(add_python_test TEST_NAME TEST_SCRIPT) ...@@ -12,5 +12,5 @@ function(add_python_test TEST_NAME TEST_SCRIPT)
set_property(TEST ${TEST_NAME} APPEND PROPERTY DEPENDS voltu_sdk) set_property(TEST ${TEST_NAME} APPEND PROPERTY DEPENDS voltu_sdk)
endfunction() endfunction()
add_python_test(Py_TestLoad test_load.py) #add_python_test(Py_TestLoad test_load.py)
add_python_test(Py_TestIntrinsics test_intrinsics.py) #add_python_test(Py_TestIntrinsics test_intrinsics.py)
...@@ -648,9 +648,17 @@ int Peer::_send() { ...@@ -648,9 +648,17 @@ int Peer::_send() {
size_t size = send_buf_.vector_size(); size_t size = send_buf_.vector_size();
char buf[20]; char buf[20];
// Calculate total size of message const uint8_t masking_key[4] = { 0x12, 0x34, 0x56, 0x78 }; // TODO: Move
// Calculate total size of message and mask it.
for (size_t i=1; i < size; i++) { for (size_t i=1; i < size; i++) {
len += sendvec[i].iov_len; const size_t mlen = sendvec[i].iov_len;
char *buf = (char*)sendvec[i].iov_base;
// TODO: Make this more efficient.
for (size_t j = 0; j != mlen; ++j) {
buf[j] ^= masking_key[(len + j)&0x3];
}
len += mlen;
} }
if (sendvec[0].iov_len != 0) { if (sendvec[0].iov_len != 0) {
...@@ -658,7 +666,7 @@ int Peer::_send() { ...@@ -658,7 +666,7 @@ int Peer::_send() {
} }
// Pack correct websocket header into buffer // Pack correct websocket header into buffer
int rc = ws_prepare(wsheader_type::BINARY_FRAME, false, len, buf, 20); int rc = ws_prepare(wsheader_type::BINARY_FRAME, true, len, buf, 20);
if (rc == -1) return -1; if (rc == -1) return -1;
// Patch the first io vector to be ws header // Patch the first io vector to be ws header
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment