@@ -96,7 +96,7 @@ impl Processor {
96
96
fn list_files ( & self , path : & str ) -> anyhow:: Result < Response > {
97
97
let dir_path = Path :: new ( & self . root_dir ) . join ( path) ;
98
98
log:: info!(
99
- "Listing files at {}" ,
99
+ "Listing files at {:? }" ,
100
100
dir_path. to_str( ) . unwrap_or( "<Unknown>" )
101
101
) ;
102
102
// Ideally we should find a way to learn the size of all files, but we need to
@@ -141,18 +141,19 @@ impl Processor {
141
141
where
142
142
F : FnMut ( CommandResponse ) ,
143
143
{
144
+ log:: info!( "Fetch file at {:?}, chunk_size={}" , path, chunk_size) ;
144
145
let mut file = std:: fs:: File :: open ( path) ?;
145
146
let file_size = file. metadata ( ) ?. len ( ) ;
146
147
let mut buf = vec ! [ 0 ; chunk_size as usize ] ;
147
148
for offset in ( 0 ..file_size) . step_by ( chunk_size as usize ) {
148
- file. read ( & mut buf) ?;
149
+ let read_size = file. read ( & mut buf) ?;
149
150
// TODO: somehow stream_position doesn't work correctly?
150
151
// assert_eq!(file.stream_position().unwrap(), offset);
151
152
send ( CommandResponse {
152
153
id : req_id. to_string ( ) ,
153
154
response : FetchFileChunk {
154
155
offset,
155
- data : & buf,
156
+ data : & buf[ ..read_size ] ,
156
157
is_final : offset + chunk_size >= file_size,
157
158
} ,
158
159
} ) ;
@@ -216,6 +217,7 @@ pub async fn process_events(
216
217
}
217
218
SessionEvent :: ReceiveText { text } => {
218
219
let request: serde_json:: Result < CommandRequest > = serde_json:: from_str ( & text) ;
220
+ log:: info!( "Processing request {:?}" , request) ;
219
221
match request {
220
222
Ok ( request) => processor. as_mut ( ) . unwrap ( ) . process (
221
223
& request,
0 commit comments