@@ -104,18 +104,18 @@ pub fn electrum_socks5_auth(
104104 let mut authenticated = false ;
105105
106106 if auth_methods. contains ( & AUTH_USERPWD ) {
107- stream. write ( & [ SOCKS5 , AUTH_USERPWD ] ) ?;
107+ stream. write_all ( & [ SOCKS5 , AUTH_USERPWD ] ) ?;
108108
109109 // Client authentication: VER=0x01, <USERLEN><USER>, <PWDLEN><PWD>
110110 ensure ! ( read_byte( & mut reader) ? == AUTH_VER , "invalid auth version" ) ;
111111 let _username = read_var ( & mut reader) ?; // the username can be anything
112112 let password = String :: from_utf8 ( read_var ( & mut reader) ?) ?;
113113 ensure ! ( password == access_token, "invalid token (userpwd)" ) ;
114114 authenticated = true ;
115- stream. write ( & [ AUTH_VER , SUCCESS ] ) ?;
115+ stream. write_all ( & [ AUTH_VER , SUCCESS ] ) ?;
116116 } else if auth_methods. contains ( & AUTH_NONE ) {
117117 // Allow no authentication for now, require hostname-based authentication instead (below)
118- stream. write ( & [ SOCKS5 , AUTH_NONE ] ) ?;
118+ stream. write_all ( & [ SOCKS5 , AUTH_NONE ] ) ?;
119119 } else {
120120 bail ! ( "incompatible auth methods" ) ;
121121 }
@@ -124,7 +124,7 @@ pub fn electrum_socks5_auth(
124124 // Where DSTADDR is either {IPv4(0x01), <ADDR>(4 bytes)} or {DOMAIN(0x03), <ADDRLEN><ADDR>}
125125 let mut buf = [ 0 ; 4 ] ;
126126 reader. read_exact ( & mut buf) ?;
127- ensure ! ( & buf[ 0 ..3 ] == & [ SOCKS5 , CONNECT , RSV ] , "invalid connect" ) ;
127+ ensure ! ( buf[ 0 ..3 ] == [ SOCKS5 , CONNECT , RSV ] , "invalid connect" ) ;
128128 match buf[ 3 ] {
129129 // Consume and ignore IPv4 addresses
130130 ADDR_IPV4 => reader. read_exact ( & mut [ 0 ; 4 ] ) ?,
@@ -142,7 +142,7 @@ pub fn electrum_socks5_auth(
142142 reader. read_exact ( & mut [ 0 ; 2 ] ) ?;
143143
144144 // Server response: VER, STATUS, RSV, BNDADDR={IPv4(0x01), =0.0.0.0}, BNDPORT=0x0000
145- stream. write ( & [
145+ stream. write_all ( & [
146146 SOCKS5 , SUCCESS , RSV , ADDR_IPV4 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
147147 ] ) ?;
148148
0 commit comments