Android DownloadManager Behaviour when using okhttp -
why buffersize of realbufferedsource(fixedlengthsource) changes 65536 2048 bytes when there exception?
2 issues m facing on downloadmanager code follows: (i m new forum. if more inputs needed, please tell me)
issue 1:
downloadmanager(a.k.a downloadthread) of android updated once 4 times read of 65536 bytes. implementation done? sorry, not find place done. specific reason update downloadthread once 4 reads?
during error scenario, happens is, if partial http fetch request downloadmanager, range: request goes last updated currentbytes value. if error happens inbetween (say, 2nd out of 4th read), range: request goes updated currentbytes may reread same bytes again.
// hc: httpconnection.java, fixedlengthsource#read print added.
19:09:10.374 system.out: (httplog)-thread-270-223795676: content-length : 70610220 19:09:10.684 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70610220,65536 19:09:10.694 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70593836,65536 19:09:10.704 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70577452,65536 19:09:10.704 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70561068,65536 19:09:10.714 downloadmanager: currentbytes : 65536,mlastupdatebytes : 0 19:09:10.714 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70544684,65536 19:09:10.714 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70528300,65536 19:09:10.724 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70511916,65536 19:09:10.754 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70495532,65536 19:09:10.774 downloadmanager: currentbytes : 131072,mlastupdatebytes : 131072 19:09:10.774 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70479148,65536 19:09:10.784 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70462764,65536 19:09:10.784 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70446380,65536 19:09:10.784 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70429996,65536 19:09:10.794 downloadmanager: currentbytes : 196608,mlastupdatebytes : 131072 19:09:10.794 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70413612,65536 19:09:10.814 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70397228,65536 19:09:10.814 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70380844,65536 19:09:10.824 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70364460,65536 19:09:10.834 downloadmanager: currentbytes : 262144,mlastupdatebytes : 131072
example:
19:09:10.794 downloadmanager: currentbytes : 196608,mlastupdatebytes : 131072 // 1st read 19:09:10.794 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70413612,65536 // 2nd read 19:09:10.814 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 70397228,65536 // if error happens here, range: request partial fetch happens using // currentbytes variable follows system.out: (httplog)-thread-270-51176450: range : bytes=196608- // ideally, should { [currentbytes : 196608] + [1st read : 65536] + [2nd read : 65536]} system.out: (httplog)-thread-270-51176450: range : bytes=327680-
issue 2:
when ioexception sslexception occurs, automatically fetch size reduced 65536 2048. implementation done? sorry, not find place done. specific reason downgrade - congestion avoidance that?
19:10:11.244 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13905628,65536 19:10:11.244 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13889244,65536 19:10:11.254 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13872860,65536 19:10:11.254 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13856476,65536 19:10:11.254 downloadmanager: currentbytes : 56754176, mlastupdatebytes : 56360960 19:10:11.254 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13840092,65536 19:10:11.264 system.out: (httplog)-static: fixedlengthsource#read:: sslexception caught... 19:10:11.264 system.out: (httplog)-static: fixedlengthsource#read, bytes remaining downloaded : 13840092 19:10:11.264 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13840092,2048 19:10:11.284 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13838044,2048 19:10:11.284 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13835996,2048 19:10:11.284 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13833948,2048 19:10:11.294 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13831900,2048 19:10:11.294 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13829852,2048 19:10:11.294 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13827804,2048 19:10:11.294 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13825756,2048 19:10:11.304 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13823708,2048 19:10:11.304 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13821660,2048 19:10:11.304 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13819612,2048 19:10:11.314 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13817564,2048 19:10:11.314 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13815516,2048 19:10:11.314 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13813468,2048 19:10:11.314 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13811420,2048 19:10:11.314 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13809372,2048 19:10:11.314 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13807324,2048 19:10:11.324 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13805276,2048 19:10:11.324 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13803228,2048 19:10:11.324 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13801180,2048 19:10:11.324 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13799132,2048 19:10:11.324 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13797084,2048 19:10:11.324 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13795036,2048 19:10:11.334 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13792988,2048 19:10:11.334 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13790940,2048 19:10:11.334 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13788892,2048 19:10:11.334 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13786844,2048 19:10:11.334 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13784796,2048 19:10:11.334 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13782748,2048 19:10:11.344 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13780700,2048 19:10:11.344 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13778652,2048 19:10:11.354 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13776604,2048 19:10:11.364 system.out: (httplog)-static: hc:: bytesremaining, bytecount ::: 13774556,2048
in case well, currentbytes of downloadthread not updated 2048xm bytes download.
so, if downloadthread partial fetch using currentbytes available it, re-read same bytes server resulting in more data usage.
please me understand if miss basic.
thank ram
Comments
Post a Comment