Skip to content

Commit ce65947

Browse files
committed
Default producer_offset to 0 for owning mux; Add CI workflow
1 parent 85d9e26 commit ce65947

3 files changed

Lines changed: 77 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
name: ${{ matrix.os }} / ${{ matrix.build_type }}
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os: [ubuntu-latest, windows-latest]
17+
build_type: [Debug, Release]
18+
19+
env:
20+
VCPKG_DIR: ${{ github.workspace }}/vcpkg
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Cache vcpkg
26+
uses: actions/cache@v4
27+
with:
28+
path: ${{ github.workspace }}/vcpkg
29+
key: vcpkg-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt') }}
30+
restore-keys: vcpkg-${{ runner.os }}-
31+
32+
- name: Bootstrap vcpkg (Linux)
33+
if: runner.os == 'Linux'
34+
run: |
35+
if [ ! -f "${{ env.VCPKG_DIR }}/vcpkg" ]; then
36+
git clone https://github.com/microsoft/vcpkg.git "${{ env.VCPKG_DIR }}"
37+
"${{ env.VCPKG_DIR }}/bootstrap-vcpkg.sh" -disableMetrics
38+
fi
39+
"${{ env.VCPKG_DIR }}/vcpkg" install nlohmann-json openssl jwt-cpp
40+
41+
- name: Bootstrap vcpkg (Windows)
42+
if: runner.os == 'Windows'
43+
shell: pwsh
44+
run: |
45+
$vcpkgDir = "${{ env.VCPKG_DIR }}"
46+
if (-not (Test-Path "$vcpkgDir\vcpkg.exe")) {
47+
git clone https://github.com/microsoft/vcpkg.git $vcpkgDir
48+
& "$vcpkgDir\bootstrap-vcpkg.bat" -disableMetrics
49+
}
50+
& "$vcpkgDir\vcpkg.exe" install nlohmann-json:x64-windows openssl:x64-windows jwt-cpp:x64-windows
51+
52+
- name: Configure (Linux)
53+
if: runner.os == 'Linux'
54+
run: |
55+
cmake -S . -B build \
56+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
57+
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_DIR }}/scripts/buildsystems/vcpkg.cmake" \
58+
-DBUILD_COINBASE_ADVANCED_TESTS=ON \
59+
-DBUILD_COINBASE_ADVANCED_EXAMPLES=OFF
60+
61+
- name: Configure (Windows)
62+
if: runner.os == 'Windows'
63+
shell: pwsh
64+
run: |
65+
cmake -S . -B build `
66+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} `
67+
"-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_DIR }}\scripts\buildsystems\vcpkg.cmake" `
68+
-DVCPKG_TARGET_TRIPLET=x64-windows `
69+
-DBUILD_COINBASE_ADVANCED_TESTS=ON `
70+
-DBUILD_COINBASE_ADVANCED_EXAMPLES=OFF
71+
72+
- name: Build
73+
run: cmake --build build --config ${{ matrix.build_type }} -j 4
74+
75+
- name: Test
76+
run: ctest --test-dir build -C ${{ matrix.build_type }} -E "(Order|Fill)" --output-on-failure

include/coinbase/websocket.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ class WebSocketClient {
162162
WebsocketCallbacks *callbacks,
163163
std::string_view market_data_url = "wss://advanced-trade-ws.coinbase.com",
164164
std::string_view user_data_url = "wss://advanced-trade-ws-user.coinbase.com",
165-
uint32_t producer_offset = 0,
166165
uint32_t md_read_buffer_size = 1u << 26, // 64 MB reading buffer
167166
uint32_t md_record_size = 1u << 16, // 64K message records
168167
const char* md_read_buffer_shm_name = nullptr, // default not using shared memory

src/websocket.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ WebSocketClient::WebSocketClient(
181181
WebsocketCallbacks *callbacks,
182182
std::string_view market_data_url,
183183
std::string_view user_data_url,
184-
uint32_t producer_offset,
185184
uint32_t md_read_buffer_size,
186185
uint32_t md_record_size,
187186
const char* md_read_buffer_shm_name,
@@ -194,7 +193,7 @@ WebSocketClient::WebSocketClient(
194193
, user_data_url_(user_data_url)
195194
, owning_mux_(new slick::stream_buffer_multiplexer(std::max(md_record_size, user_record_size) * 2))
196195
, mux_(*owning_mux_.get())
197-
, producer_offset_(producer_offset)
196+
, producer_offset_(0)
198197
, user_thread_callbacks_(dynamic_cast<UserThreadWebsocketCallbacks*>(callbacks))
199198
{
200199
init(

0 commit comments

Comments
 (0)