Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatbuffers #927

Closed
wants to merge 321 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
321 commits
Select commit Hold shift + click to select a range
0ead186
restore debug modification
jmillan Oct 27, 2022
c98f8a1
flatbuffers: Make all response body types contain the 'Response' sufix
jmillan Oct 28, 2022
271fa93
flatbuffers schemas cleanup
jmillan Nov 2, 2022
873b91a
transport.dump() maps are now arrays
jmillan Nov 2, 2022
6a3db2f
Router: check numSctpStreams param
jmillan Nov 2, 2022
34a3cc7
worker: format
jmillan Nov 2, 2022
32129fd
remove fbs/utils.ts file
jmillan Nov 2, 2022
0324d9f
remove flatbuffers auto generated folder before re-generating them
jmillan Nov 2, 2022
1bfa2c6
Transport.dump(), traceEventTypes contains a string array
jmillan Nov 2, 2022
8fc6000
WebRtcTransport tests pass
jmillan Nov 2, 2022
b5d4a7e
flatbuffers: allow same type name in different namespace
jmillan Nov 3, 2022
a98a2c7
lint
jmillan Nov 3, 2022
8cfc859
schema 'required' label consistency
jmillan Nov 4, 2022
0c3ece3
utils: parserVector optional argument to parse each instance
jmillan Nov 8, 2022
3ae27fb
PlainTransport: Creation and Dump
jmillan Nov 8, 2022
14d6778
Worker: remove old code
jmillan Nov 9, 2022
50b6bcb
fbs: cosmetic
jmillan Nov 9, 2022
6903041
Transport [TS]: make dump() method abstract
jmillan Nov 9, 2022
d86cdbc
C++: unify JSON and Flatbuffers request handling in the same switch
jmillan Nov 10, 2022
eb0b0d3
PipeTransport
jmillan Nov 10, 2022
7e55458
fix comment
jmillan Nov 10, 2022
2a69ecf
format
jmillan Nov 10, 2022
c029856
Merge remote-tracking branch 'origin/v3' into flatbuffers
jmillan Nov 11, 2022
d4060ff
update .js and ts.map from latest changes
jmillan Nov 11, 2022
2c03580
DirectTransport
jmillan Nov 11, 2022
af7e7e0
RtpObserver
jmillan Nov 11, 2022
ae4a869
RtpObserver: threshold must be negative
jmillan Nov 11, 2022
053ed1a
format
jmillan Nov 11, 2022
4404565
AudioLevelObserver
jmillan Nov 11, 2022
3c35b5e
'router.closeTransport'
jmillan Nov 11, 2022
3d672f9
'router.closeRtpObserver'
jmillan Nov 11, 2022
d63937e
remove any JSON reference from Router
jmillan Nov 11, 2022
89575ff
SvcConsumer creation
jmillan Nov 11, 2022
565161b
Remove old 'transport.consume' reference
jmillan Nov 11, 2022
d88f0e1
'transport.setMaxIncomingBitrate' and 'transport.setMaxOutgoingBitrate'
jmillan Nov 11, 2022
87bbd08
'transport.enableTraceEvent'
jmillan Nov 11, 2022
31b1ca0
'transport.[closeProducer|closeConsumer|closeDataProducer|closeDataCo…
jmillan Nov 11, 2022
8796855
format
jmillan Nov 11, 2022
25c7b28
naming consistency
jmillan Nov 11, 2022
7433dfc
[TS] Transport: fix handlerId
jmillan Nov 12, 2022
c0781f4
[TS] Transport: enableTraceEvent, verify arguments
jmillan Nov 12, 2022
7e52c88
'transport.produce'
jmillan Nov 13, 2022
8976223
test: remove dev log
jmillan Nov 13, 2022
cab5930
'[producer|consumer|rtpObserver]-[pause|resume]'
jmillan Nov 13, 2022
0eab6e1
'rtpObserver.[add-remove]Producer'
jmillan Nov 13, 2022
1aff0bd
fix worker dump flabtuffers schema name case
jmillan Nov 14, 2022
fd8cfbf
[produce-consumer].enableTraceEvent
jmillan Nov 14, 2022
9724811
[FBS]: Make consumer preferred temporal layer optional
jmillan Nov 14, 2022
24672ed
[FBS] Properly handle HeaderExtensionParameters.parameters
jmillan Nov 15, 2022
aa34c0f
'consumer.setPreferredLayers'
jmillan Nov 15, 2022
618fe67
'consumer.setPriority'
jmillan Nov 15, 2022
00e9ea3
[TS] Transport: fix produce(), respect Producer id, if given
jmillan Nov 15, 2022
fa75496
[FBS] Router: fix typo in ROUTER_DUMP processing
jmillan Nov 15, 2022
6eb624f
remove unused JSON code
jmillan Nov 15, 2022
a6fd171
Adapt tests to router.Dump()
jmillan Nov 15, 2022
b60f74b
'dataConsumer.getBufferedAmount'
jmillan Nov 15, 2022
d6b1c8d
flatbuffers generated code after case change
jmillan Nov 15, 2022
13d4c5b
'dataConsumer.setBufferedAmountLowThreshold'
jmillan Nov 15, 2022
2b88c5e
'dataConsumer.setBufferedAmountLowThreshold', await for the response …
jmillan Nov 15, 2022
a837a6a
update js file
jmillan Nov 16, 2022
7b6669d
flatbuffers: handle optional scalar values
jmillan Nov 17, 2022
9207374
flatbuffers: handle optional temporal layer
jmillan Nov 17, 2022
14ffc02
format
jmillan Nov 17, 2022
883f781
lint
jmillan Nov 17, 2022
b8aba90
'transport.produceData' and 'dataProducer.dump'
jmillan Nov 18, 2022
6e83b8c
'transport.consumeData' and 'dataConsumer.dump'
jmillan Nov 18, 2022
a20583d
WIP 'producer.dump' and 'consumer.dump'
jmillan Nov 19, 2022
6a05eb9
Merge remote-tracking branch 'origin/v3' into flatbuffers
jmillan Nov 20, 2022
9786f1e
format
jmillan Nov 20, 2022
2e83834
Makefile & npm-scripts: build flatc
jmillan Nov 20, 2022
97062ac
update package-lock.json with flatbuffers
jmillan Nov 20, 2022
b2e6248
fix case on fbs imported file
jmillan Nov 20, 2022
38fe908
remove flatc generated TypeScript code from the repo
jmillan Nov 20, 2022
f0188fe
npm-scripts: lintNode, specify the .eslintignore file path
jmillan Nov 21, 2022
dd0809c
npm-scripts: call flatcNode() from buildTypescript()
jmillan Nov 21, 2022
234ad9a
parseProducerDump
jmillan Nov 21, 2022
051f665
Merge remote-tracking branch 'origin/v3' into flatbuffers
jmillan Nov 21, 2022
75d35ad
test: properly check if an Array is of type Array
jmillan Nov 21, 2022
8e3a29e
parseConsumerDump: WIP
jmillan Nov 21, 2022
4b7d05d
parseConsumerDump
jmillan Nov 22, 2022
30e0485
npm-scripts: reduce calls to flatcNode()
jmillan Nov 22, 2022
9bf9b98
RtpParameters: remove extra field 'mux' in RtcpParameters
jmillan Nov 22, 2022
23d3d0f
RtpEncodingParameters: 'ssrc' field in 'rtx' is mandatory
jmillan Nov 22, 2022
d2eae34
Remove from the sources flatbuffers generated .h header files
jmillan Nov 22, 2022
41ef184
.gitattributes: add fbs/ folder as linguist vendored
jmillan Nov 22, 2022
b61fd93
'transport.restartIce'
jmillan Nov 22, 2022
bf2e0bf
'transport.connect'
jmillan Nov 24, 2022
70e5ef4
[TS] PipeTransport, fix connect() request creation
jmillan Nov 24, 2022
7c5d345
'X.getStats()'
jmillan Nov 24, 2022
c5f0925
ChannelRequest: rename temporal _data variable to data
jmillan Nov 24, 2022
e34fa68
Remove remaining JSON from references ChannelRequest
jmillan Nov 24, 2022
5b19cf3
[TS] Channel: remove old 'request()' method
jmillan Nov 24, 2022
6f9af44
[TS] Channel: rename requestBinary() to request()
jmillan Nov 24, 2022
19b7bd2
cosmetic
jmillan Nov 24, 2022
2c462a4
Worker: reset flatbuffer builder upon TypeError response
jmillan Nov 25, 2022
032d0fb
[TS] reorganize code
jmillan Nov 25, 2022
445e3bd
[TS] cleanup
jmillan Nov 25, 2022
6dd5a4e
Everything coming from worker is a flatbuffer
jmillan Nov 25, 2022
7c957f6
RequestSender: Send(response) private method
jmillan Nov 27, 2022
a0e7a42
WIP: PayloadChannel
jmillan Nov 28, 2022
c6e146f
lint
jmillan Nov 28, 2022
796ce1d
Naming enhancement
jmillan Nov 28, 2022
1532bf5
Notifications from worker WIP
jmillan Nov 28, 2022
5de5b7b
Notifications from worker II
jmillan Nov 29, 2022
ab9458a
Consumer trace events
jmillan Nov 30, 2022
c6b6ea1
Producer notification coming from Worker
jmillan Nov 30, 2022
5487bd1
PlainTransport notifications coming from Worker
jmillan Nov 30, 2022
9557758
ActiveSpeakerObserver notifications coming from Worker
jmillan Nov 30, 2022
6178ae3
AudioLevelObserver notifications coming from Worker
jmillan Nov 30, 2022
cad7a32
WebRtcTransport: iceselecttuplechange notification
jmillan Nov 30, 2022
d695d18
Transport: trace notification
jmillan Nov 30, 2022
4af4f62
DirectTransport notifications from worker
jmillan Dec 1, 2022
fc579d2
[Channel|PayloadChannel]: remove json usages
jmillan Dec 1, 2022
09a9857
Worker: use flatbuffers for 'running' event
jmillan Dec 1, 2022
46cbdf9
Remove temporal JsonNotification
jmillan Dec 1, 2022
66af4da
Use a single Channel Socket for worker communication
jmillan Dec 3, 2022
d55f474
fix typo
jmillan Dec 7, 2022
f36a060
Remove non used JSON code
jmillan Dec 7, 2022
1d866ff
Remove non used JSON code
jmillan Dec 7, 2022
9685482
Remove non used JSON code. Cont.
jmillan Dec 7, 2022
b1aa9f3
[TS] Transport: move 'createConsumeRequest' method out of the class d…
jmillan Dec 7, 2022
35e8330
Update to latest flatbuffers version
jmillan Dec 12, 2022
8f94bcd
jest: remove '.js' extension from imported files
jmillan Dec 12, 2022
017ed46
Merge remote-tracking branch 'origin/v3' into flatbuffers
jmillan Dec 12, 2022
a7f8acb
.github worker workflow: compile flatbuffers schemas
jmillan Dec 12, 2022
e01c01d
[Worker] Tests: remove tests for non existent code
jmillan Dec 12, 2022
602226c
[TS] lint
jmillan Dec 12, 2022
7999cd2
Convert BigInt values into Number
jmillan Dec 12, 2022
a45d1d1
Producer|Consumer stats
jmillan Dec 13, 2022
2fe6ed5
Transports stats
jmillan Dec 14, 2022
085731b
DataProducer|DataConsumer stats
jmillan Dec 14, 2022
77f0732
remove remaining json references
jmillan Dec 14, 2022
49fa350
remove remaining json references
jmillan Dec 14, 2022
570ad60
RtpEncodingParameters: Remove extra info
jmillan Dec 14, 2022
c17acab
lint
jmillan Dec 14, 2022
690e2ac
enhance naming
jmillan Dec 14, 2022
80afa87
[FBS] cosmetic
jmillan Dec 14, 2022
b3480c4
[C++] Remove last JSON usages
jmillan Dec 14, 2022
d5e4e3c
Remove nlohmann JSON dependency
jmillan Dec 14, 2022
e665e6c
[TS] Channel: Call write() a single time per message
jmillan Dec 14, 2022
b98b461
[C++] ChannelSocket: Avoid 2 memcpy when sending out a message
jmillan Dec 14, 2022
bbb008f
[C++] test: Add missing include statement in test
jmillan Dec 15, 2022
d8bbbf2
[FBS]: Define dump|connect schemas on their own transport schemas
jmillan Dec 15, 2022
8ae1254
[FBS] Transport: normalize transport dump table name
jmillan Dec 16, 2022
4497295
[C++] Qualified auto
jmillan Dec 19, 2022
1fdc98b
[FBS] Schemas: make base tansport options 'required'
jmillan Dec 19, 2022
73239a4
[FBS]: Define stats schemas on their own transport schemas
jmillan Dec 19, 2022
19bd84b
[FBS]: Define options schemas on their own rtp observer schemas
jmillan Dec 19, 2022
e666087
[FBS]: Simplify Consumer dump()
jmillan Dec 19, 2022
25f7142
[C++] Clean TODO's
jmillan Dec 19, 2022
a31d7f1
[C++]: Cleanup TODO. Cont
jmillan Dec 19, 2022
ca047e3
[C++]: Cleanup TODO. Cont
jmillan Dec 19, 2022
3c6bd50
[C++]: Cleanup TODO. Cont
jmillan Dec 19, 2022
77ae903
[C++] Cleanup
jmillan Dec 19, 2022
908bd89
[C++] Remove redundant include statements
jmillan Dec 19, 2022
8026051
[FBS] Schemas cleanup
jmillan Dec 19, 2022
87b6e7d
[C++] clang-format: Add FBS to IncludeCategories
jmillan Dec 19, 2022
7a67ad1
[TS]: Channel 'processLog()'
jmillan Dec 19, 2022
b63a3e5
[FBS]: schemas cleanup
jmillan Dec 20, 2022
6b0b448
[TS]: cleanup
jmillan Dec 20, 2022
7ec2ab0
[TS]: cleanup
jmillan Dec 20, 2022
3d7a476
[TS]: cleanup
jmillan Dec 20, 2022
47c913f
Data[Producer|Consumer]: differenciate between string and binary data
jmillan Dec 22, 2022
a3c538a
[C++] Channel[Request|Notification]: check method|event
jmillan Dec 22, 2022
7b3f8fb
.github: TMP, enable env variable to debug CI error
jmillan Dec 22, 2022
c8ccaa0
lint
jmillan Dec 22, 2022
e0c6f89
.github: surround env variable value
jmillan Dec 22, 2022
06070d3
[C++] WebRtcTransport: check existence of FBS announced IP
jmillan Dec 23, 2022
5c65ba4
FBS: Fix required fileds in Linux
jmillan Dec 24, 2022
82545a7
FBS: build flatc for Windows
jmillan Dec 24, 2022
ce475f4
Rust: Remove Payload Channel
jmillan Jan 16, 2023
ef9144a
Rust: compile flatbuffers schemas during build process
jmillan Jan 24, 2023
c84a2f5
Rust: generate flatbuffers code with serialization traits
jmillan Jan 25, 2023
3a58d7f
flatc: compile flatc and .fbs file as part of the build process
jmillan Feb 1, 2023
b7cdedc
flatbuffers: move schemas to worker folder
jmillan Feb 1, 2023
b9969d1
package.json: Add fbs folder to published npm
jmillan Feb 1, 2023
7eeadb9
Rust: add fbs.rs
jmillan Feb 1, 2023
b72b2b6
.gitignore: ignore rust/src/fbs folder
jmillan Feb 1, 2023
23b90ba
npm-scripts: flatcNode, build flatc binary if needed
jmillan Feb 1, 2023
ff14610
Makefile: new flatc-all target
jmillan Feb 1, 2023
245c342
Rust: remove flatbuffers code generation
jmillan Feb 1, 2023
fffd4e5
Rust: format
jmillan Feb 1, 2023
4f67362
Merge branch 'v3' into flatbuffers
jmillan Feb 1, 2023
3e0eb00
fbs: remove useless comment
jmillan Feb 1, 2023
6c10e82
update flatbuffers version
jmillan Feb 8, 2023
3107b97
Revert "update flatbuffers version"
jmillan Feb 9, 2023
09cba50
Makefile: flatc, do not generate .cpp code if FBS folder exists
jmillan Feb 13, 2023
b7593db
Rust: channel.rs, print logs coming from worker.
jmillan Feb 14, 2023
674055b
Rust: add fbs.rs file
jmillan Feb 15, 2023
8007d83
Rust: github workflow, comment cargo test
jmillan Feb 15, 2023
3a93d04
Rust: fmt
jmillan Feb 15, 2023
d29b920
Rust: ignore linter for fbs.rs
jmillan Feb 16, 2023
dc7e8e1
Merge remote-tracking branch 'origin/v3' into flatbuffers
jmillan Feb 16, 2023
0fcee3b
C++: lint
jmillan Feb 16, 2023
9ac4bcb
Merge remote-tracking branch 'origin/v3' into flatbuffers
jmillan Feb 16, 2023
2abf18f
.gitignore: remove reference to non existent folder
jmillan Feb 23, 2023
4be7041
.gitignore: cleanup comments
jmillan Feb 23, 2023
0ce9779
.eslintrc cleanup
jmillan Feb 23, 2023
c5aaecd
workflows: cleanup
jmillan Feb 23, 2023
1d19df2
npm-scripts: flatc:node, do not clean stuff on dev environment
jmillan Feb 23, 2023
b1f4492
Merge remote-tracking branch 'origin/v3' into flatbuffers
jmillan Feb 23, 2023
60231c9
Node: add curly everywhere
jmillan Feb 23, 2023
2c0af16
Node: Channel, remove unneeded new #pid member
jmillan Feb 23, 2023
beefc42
Node: test, add missing tests
jmillan Feb 24, 2023
a71d41d
npm-scripts: cleanWorker, remove msys folder if present
jmillan Feb 24, 2023
6b6b05c
workflows: codeql, revert change
jmillan Mar 1, 2023
511934f
FBS: DominantSpeakerNotification produced_id field is mandatory
jmillan Mar 1, 2023
7e81d23
node: Channel, add comment
jmillan Mar 1, 2023
2d679cb
node: Consumer, enhance fbs preferred layers buffer creation
jmillan Mar 1, 2023
a776ff0
node: Consumer, enhance fbs set priority request creation
jmillan Mar 1, 2023
130503f
cosmetic
jmillan Mar 1, 2023
d325746
C++: Data[Consumer|Producer], type is mandatory
jmillan Mar 1, 2023
69f5840
cosmetic
jmillan Mar 1, 2023
c9543b0
C++: Performance, preallocate vector space
jmillan Mar 1, 2023
e43ab6b
cosmetic
jmillan Mar 1, 2023
5aee46b
C++: Const correctness
jmillan Mar 1, 2023
6cb6401
C++: Performance, correctly preallocate vector space
jmillan Mar 3, 2023
6845f7a
upgrade flatbuffers to 23.3.3
jmillan Mar 13, 2023
ac7ec6c
feedback: remove black lines after comment
jmillan Mar 13, 2023
78c6c1e
TS: flatbuffers do not use any extension for imported files
jmillan Mar 13, 2023
89ad657
TS: remove temporal checks
jmillan Mar 13, 2023
227a8a0
npm-scripts: consider build type for flatc:node
jmillan Mar 13, 2023
2ecaa51
TS: wrap flatbuffers Error with TypeError
jmillan Mar 13, 2023
ee08655
Merge branch 'v3' into flatbuffers
jmillan Mar 13, 2023
01d36f2
Merge branch 'v3' into flatbuffers
ibc Mar 21, 2023
fee1918
cosmetic
ibc Mar 21, 2023
87e0b14
Merge branch 'v3' into flatbuffers
ibc Mar 29, 2023
9cb67b3
Merge branch 'v3' into flatbuffers
ibc Mar 29, 2023
d5c095a
Merge branch 'v3' into flatbuffers
ibc Mar 29, 2023
16bf59f
Merge branch 'v3' into flatbuffers
ibc Apr 4, 2023
3a2a902
Merge branch 'v3' into flatbuffers
ibc Apr 4, 2023
22781ac
Remove wrong log
ibc Apr 4, 2023
ac56aca
rust: receive fist notification from worker
jmillan Mar 29, 2023
9fe550c
WIP
nazar-pc Mar 31, 2023
f069eca
Channel: request_fbs, initial request implementation
jmillan Apr 12, 2023
cb7c7a6
lint
jmillan Apr 12, 2023
8177282
WIP: FBS requests
jmillan Apr 12, 2023
ae551fb
worker.update_settings: build the FBS request accordingly
jmillan Apr 12, 2023
9773f83
request_fbs: pass the builder via argument
jmillan Apr 13, 2023
c18a9cf
update fbs.rs to the lastest schemas state
jmillan Apr 13, 2023
03e5575
Fix response type
jmillan Apr 13, 2023
de9f705
worker: create_router()
jmillan Apr 13, 2023
f2c4160
clippy
jmillan Apr 13, 2023
50c34bb
clippy
jmillan Apr 13, 2023
111cdec
remove unused import
jmillan Apr 13, 2023
363b162
set lint attribute for fbs out of the autogenerated file
jmillan Apr 14, 2023
4e247e3
fbs: use alias on response body variants
jmillan Apr 14, 2023
68b52a0
run cargo fmt
ibc Apr 14, 2023
11c8663
Minimal cleanup, clippy is happy now
nazar-pc Apr 15, 2023
e858e5c
Replace static variables with regular class variables, remove unused …
nazar-pc Apr 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ hash_hasher = "2.0.3"
log = "0.4.17"
nohash-hasher = "0.2.0"
once_cell = "1.16.0"
planus = "0.3.1"
serde_json = "1.0.87"
serde_repr = "0.1.9"
thiserror = "1.0.37"
planus = "0.3.1"

[dependencies.lru]
default-features = false
Expand All @@ -52,10 +52,6 @@ version = "0.5.4"
version = "0.12.1"
features = ["serde"]

[dependencies.flatbuffers]
version = "23.1.21"
features = ["serialize"]

[dependencies.regex]
default-features = false
features = ["std", "perf"]
Expand Down
5 changes: 4 additions & 1 deletion rust/src/fbs.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
pub use root::*;
//! Flatbuffers data structures compiled from `.fbs` files
pub use root::fbs::*;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice


const _: () = ::planus::check_version_compatibility("planus-0.3.1");

#[no_implicit_prelude]
mod root {
#[allow(missing_docs)]
#[allow(clippy::all)]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is auto-generated. Do we need to add this changes manually when the flatbuffers schema changes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the way you had it before could suppress the whole project. This will is currently committed into the repo, but it will be replaced with actually auto-generated during compile time in mediasoup-sys in the future, so these changes are temporary either way.

pub mod fbs {
pub mod active_speaker_observer {
#[derive(
Expand Down
2 changes: 0 additions & 2 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
//! and are a good place to start until we have demo apps built in Rust).

pub mod data_structures;
#[allow(missing_docs)]
#[allow(clippy::all)]
pub mod fbs;
mod macros;
mod messages;
Expand Down
2 changes: 1 addition & 1 deletion rust/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod common;
mod utils;

use crate::data_structures::AppData;
use crate::fbs::fbs;
use crate::fbs;
use crate::messages::{WorkerCreateWebRtcServerRequest, WorkerDumpRequest};
pub use crate::ortc::RtpCapabilitiesError;
use crate::router::{Router, RouterId, RouterOptions};
Expand Down
14 changes: 4 additions & 10 deletions rust/src/worker/channel.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::fbs::fbs::{message, notification, request, response};
use crate::fbs::{message, notification, request, response};
use crate::messages::{Notification, Request, WorkerCloseRequest};
use crate::worker::common::{
EventHandlers, FBSEventHandlers, FBSWeakEventHandlers, SubscriptionTarget, WeakEventHandlers,
Expand All @@ -18,7 +18,6 @@ use serde_json::Value;
use std::any::TypeId;
use std::collections::VecDeque;
use std::fmt::{Debug, Display};
use std::io::copy;
use std::num::NonZeroUsize;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Weak};
Expand Down Expand Up @@ -92,7 +91,7 @@ enum ChannelReceiveMessage<'a> {
Event(InternalMessage),
}

fn deserialize_message<'a>(bytes: &'a [u8]) -> ChannelReceiveMessage<'_> {
fn deserialize_message(bytes: &[u8]) -> ChannelReceiveMessage<'_> {
let message_ref = message::MessageRef::read_as_root(&bytes[4..]).unwrap();

match message_ref.data().unwrap() {
Expand Down Expand Up @@ -560,20 +559,15 @@ impl Channel {

debug!("request() [method:{:?}, id:{}]", method, id);

// TODO: Can't we use directly the buffer of the builder, since we own it?.
let mut copied: Vec<u8> = vec![];

let request =
request::Request::create(&mut builder, id, method, handler_id.to_string(), body);

let message_body = message::Body::create_request(&mut builder, request);
let message = message::Message::create(&mut builder, message::Type::Request, message_body);

let mut data = builder.finish(message, None);

copy(&mut data, &mut copied).unwrap();
let data = builder.finish(message, None).to_vec();

let buffer = Arc::new(AtomicTake::new(copied));
let buffer = Arc::new(AtomicTake::new(data));

{
let mut outgoing_message_buffer = self.inner.outgoing_message_buffer.lock();
Expand Down
2 changes: 1 addition & 1 deletion rust/src/worker/common.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::fbs::fbs::notification;
use crate::fbs::notification;
use hash_hasher::HashedMap;
use nohash_hasher::IntMap;
use parking_lot::Mutex;
Expand Down