Skip to content

Commit

Permalink
Merge 3a46a9a into 0675024
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuef committed Jan 11, 2022
2 parents 0675024 + 3a46a9a commit 39b952b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ impl Connection {
/// This is not a graceful close - pending operations will fail immediately with
/// [`ConnectionError::Closed`]`(`[`Close::Local`]`)`, and data on unfinished streams is not
/// guaranteed to be delivered.
pub fn close(&self) {
self.inner.close(0u8.into(), b"");
pub fn close(&self, reason: Option<String>) {
let reason = reason.unwrap_or("The connection was closed intentionally by qp2p.".to_string());
self.inner.close(0u8.into(), &reason.into_bytes());
}

async fn send_uni(&self, msg: Bytes, priority: i32) -> Result<(), SendError> {
Expand Down

0 comments on commit 39b952b

Please sign in to comment.