Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8488a46

Browse files
committed
fix: properly announce connection closure during error
1 parent490c485 commit8488a46

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

‎tokio-postgres/src/connection.rs‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,14 +298,7 @@ where
298298
self.parameters.get(name).map(|s|&**s)
299299
}
300300

301-
/// Polls for asynchronous messages from the server.
302-
///
303-
/// The server can send notices as well as notifications asynchronously to the client. Applications that wish to
304-
/// examine those messages should use this method to drive the connection rather than its `Future` implementation.
305-
///
306-
/// Return values of `None` or `Some(Err(_))` are "terminal"; callers should not invoke this method again after
307-
/// receiving one of those values.
308-
pubfnpoll_message(
301+
fnpoll_message_inner(
309302
&mutself,
310303
cx:&mutContext<'_>,
311304
) ->Poll<Option<Result<AsyncMessage,Error>>>{
@@ -323,6 +316,26 @@ where
323316
},
324317
}
325318
}
319+
320+
/// Polls for asynchronous messages from the server.
321+
///
322+
/// The server can send notices as well as notifications asynchronously to the client. Applications that wish to
323+
/// examine those messages should use this method to drive the connection rather than its `Future` implementation.
324+
///
325+
/// Return values of `None` or `Some(Err(_))` are "terminal"; callers should not invoke this method again after
326+
/// receiving one of those values.
327+
pubfnpoll_message(
328+
&mutself,
329+
cx:&mutContext<'_>,
330+
) ->Poll<Option<Result<AsyncMessage,Error>>>{
331+
matchself.poll_message_inner(cx){
332+
nominal @(Poll::Pending |Poll::Ready(Some(Ok(_)))) => nominal,
333+
terminal @(Poll::Ready(None) |Poll::Ready(Some(Err(_)))) =>{
334+
self.receiver.close();
335+
terminal
336+
}
337+
}
338+
}
326339
}
327340

328341
impl<S,T>FutureforConnection<S,T>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp