File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -88,10 +88,10 @@ impl Connection {
88
88
89
89
fn sync ( & mut self ) -> Result < ( ) , Error > {
90
90
self . with_timeout ( CommandType :: Sync . timeout ( ) , |connection| {
91
- connection. write_command ( Command :: Sync ) ?;
91
+ connection. command ( Command :: Sync ) ?;
92
92
connection. flush ( ) ?;
93
93
sleep ( Duration :: from_millis ( 10 ) ) ;
94
- for _ in 0 ..100 {
94
+ for _ in 0 ..7 {
95
95
match connection. read_response ( ) ? {
96
96
Some ( response) if response. return_op == CommandType :: Sync as u8 => {
97
97
if response. status == 1 {
@@ -100,24 +100,20 @@ impl Connection {
100
100
CommandType :: Sync ,
101
101
RomErrorKind :: from ( response. error ) ,
102
102
) ) ) ;
103
- } else {
104
- break ;
105
103
}
106
104
}
107
- _ => continue ,
105
+ _ => {
106
+ return Err ( Error :: RomError ( RomError :: new (
107
+ CommandType :: Sync ,
108
+ RomErrorKind :: InvalidMessage ,
109
+ ) ) )
110
+ }
108
111
}
109
112
}
110
113
111
114
Ok ( ( ) )
112
115
} ) ?;
113
116
114
- for _ in 0 ..700 {
115
- match self . read_response ( ) ? {
116
- Some ( _) => break ,
117
- _ => continue ,
118
- }
119
- }
120
-
121
117
Ok ( ( ) )
122
118
}
123
119
You can’t perform that action at this time.
0 commit comments