-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adding check and improve buffer size
Signed-off-by: Simon Paitrault <[email protected]>
- Loading branch information
Showing
6 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,6 +248,7 @@ impl NetworkBehaviour for Behaviour { | |
}, | ||
_ => {} | ||
}; | ||
|
||
Poll::Pending | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,23 @@ | ||
use std::env; | ||
|
||
use lazy_static::lazy_static; | ||
|
||
// TODO: Investigate BUFFER SIZE | ||
pub const EVENT_STREAM_BUFFER: usize = 2048; | ||
|
||
lazy_static! { | ||
pub static ref EVENT_STREAM_BUFFER: usize = env::var("TCE_EVENT_STREAM_BUFFER") | ||
.ok() | ||
.and_then(|v| v.parse::<usize>().ok()) | ||
.unwrap_or(2048 * 2); | ||
pub static ref CAPACITY_EVENT_STREAM_BUFFER: usize = EVENT_STREAM_BUFFER | ||
.checked_mul(10) | ||
.map(|v| { | ||
let r: usize = v.checked_div(100).unwrap_or(*EVENT_STREAM_BUFFER); | ||
r | ||
}) | ||
.unwrap_or(*EVENT_STREAM_BUFFER); | ||
} | ||
|
||
pub const COMMAND_STREAM_BUFFER: usize = 2048; | ||
pub const TRANSMISSION_PROTOCOL: &str = "/tce-transmission/1"; | ||
pub const DISCOVERY_PROTOCOL: &str = "/tce-disco/1"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters