File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,29 @@ pub struct CancelData {
57
57
pub secret_key : i32 ,
58
58
}
59
59
60
+ pub fn cancel_query < T > ( params : T ,
61
+ tls_mode : TlsMode ,
62
+ cancel_data : CancelData ,
63
+ handle : & Handle )
64
+ -> BoxFuture < ( ) , ConnectError >
65
+ where T : IntoConnectParams
66
+ {
67
+ let params = match params. into_connect_params ( ) {
68
+ Ok ( params) => {
69
+ Either :: A ( stream:: connect ( params. host ( ) . clone ( ) , params. port ( ) , tls_mode, handle) )
70
+ }
71
+ Err ( e) => Either :: B ( Err ( ConnectError :: ConnectParams ( e) ) . into_future ( ) )
72
+ } ;
73
+
74
+ params. and_then ( move |c| {
75
+ let mut buf = vec ! [ ] ;
76
+ frontend:: cancel_request ( cancel_data. process_id , cancel_data. secret_key , & mut buf) ;
77
+ c. send ( buf) . map_err ( ConnectError :: Io )
78
+ } )
79
+ . map ( |_| ( ) )
80
+ . boxed ( )
81
+ }
82
+
60
83
struct InnerConnection {
61
84
stream : PostgresStream ,
62
85
close_receiver : Receiver < ( u8 , String ) > ,
You can’t perform that action at this time.
0 commit comments