File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -318,14 +318,7 @@ where
318
318
self . parameters . get ( name) . map ( |s| & * * s)
319
319
}
320
320
321
- /// Polls for asynchronous messages from the server.
322
- ///
323
- /// The server can send notices as well as notifications asynchronously to the client. Applications that wish to
324
- /// examine those messages should use this method to drive the connection rather than its `Future` implementation.
325
- ///
326
- /// Return values of `None` or `Some(Err(_))` are "terminal"; callers should not invoke this method again after
327
- /// receiving one of those values.
328
- pub fn poll_message (
321
+ fn poll_message_inner (
329
322
& mut self ,
330
323
cx : & mut Context < ' _ > ,
331
324
) -> Poll < Option < Result < AsyncMessage , Error > > > {
@@ -343,6 +336,26 @@ where
343
336
} ,
344
337
}
345
338
}
339
+
340
+ /// Polls for asynchronous messages from the server.
341
+ ///
342
+ /// The server can send notices as well as notifications asynchronously to the client. Applications that wish to
343
+ /// examine those messages should use this method to drive the connection rather than its `Future` implementation.
344
+ ///
345
+ /// Return values of `None` or `Some(Err(_))` are "terminal"; callers should not invoke this method again after
346
+ /// receiving one of those values.
347
+ pub fn poll_message (
348
+ & mut self ,
349
+ cx : & mut Context < ' _ > ,
350
+ ) -> Poll < Option < Result < AsyncMessage , Error > > > {
351
+ match self . poll_message_inner ( cx) {
352
+ nominal @ ( Poll :: Pending | Poll :: Ready ( Some ( Ok ( _) ) ) ) => nominal,
353
+ terminal @ ( Poll :: Ready ( None ) | Poll :: Ready ( Some ( Err ( _) ) ) ) => {
354
+ self . receiver . close ( ) ;
355
+ terminal
356
+ }
357
+ }
358
+ }
346
359
}
347
360
348
361
impl < S , T > Future for Connection < S , T >
You can’t perform that action at this time.
0 commit comments