[sane-devel] saned/sanei net bug

Johannes Berg johannes@sipsolutions.net
Fri, 15 Oct 2004 16:03:04 +0200


--=-b6utnWCS15VlnOe3728l
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

somehow saned/the sanei network layer seem to get buffering wrong.

For example, I send the following:

SANE_NET_INIT
SANE_NET_GET_DEVICES
SANE_NET_EXIT

If I don't wait for the result from SANE_NET_GET_DEVICES before sending
the control code for SANE_NET_EXIT, then the SANE_NET_EXIT code is
discarded.
I would assume that somewhere there's a buffering problem and the old
buffer is simply dropped when the direction is changed or something.

The following works:
(echo  -n -e \\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00 ;
sleep .1 ; echo -n -e \\00\\00\\x00\\x01 ; sleep 1 ;
echo -en \\x00\\x00\\x00\\x0A ) | nc localhost 6566 -q 1 | hd

while this doesn't:
(echo  -n -e \\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00 ;
sleep .1 ; echo -n -e \\00\\00\\x00\\x01\\x00\\x00\\x00\\x0A
)| nc localhost 6566 -q 1 | hd

I think this is extremely counter-intuitive. TCP never guarantees
message boundaries, so one wouldn't think that data is explicitly read
by the application but then discarded.

johannes

--=-b6utnWCS15VlnOe3728l
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Comment: Johannes Berg (SIP Solutions)

iQIVAwUAQW/YlaVg1VMiehFYAQLFPg//WIumi+9ZBodt1Ns31jdYGEiJa5z0hvkx
RivmO96L+BnL6Ld7Rut2mWx7ftE88yEhWnyzwBj3eFYseXi72n/2E12dpzyKyx+d
4ASxTTeatA/50Prdn2VzaPNe4zccKFpTJdYM7AXYDq3E49XyBrQ0fzin+rCaW0Pd
hjhD+bzzVuWxFxSgTsQn8T9z8h43W5BcUdD+a9fxZZMwRapXaFhTiFCTBxNH2zSI
yHCa7+Kx8xsGoTjsMt3BiggIn0k0ofNaSzht8BaYR0uelnKDEHrj+JdJgpfOz8OK
KcX3gPhsL5JdT4KbmuGyuJSkhZ9gdOGmneBkpX5WB/zUBvS8FxBLM0yyiAmqgzF1
rU9oqAg9psQgotkQY+koeJk8WnOHrstxgHX6rUO6Dbg2EIOv5tNDL/QZ1c/CAQY1
gcPf67was/FbFQ/WDhgyd4C3WdMDnaMrC9WZwIk1klxj6gFz0RqzcQbF97+s+OX0
yAgdl2V3b2SuYW9x9oojshxA6NN+yd3WrIhWxFFlOxkxrdoE1WGlPGwUvQwcVBja
KArLPRV4eHM6c8T0RyK6XWfC2aCOZ004EzTtPyOW8ARZZl026gGXNaF/jlw2L1PN
UiU8+spF5v4pBiQaiYmmEasGaaHmwHYL6oBI6PV2iMjUnFTz4dYM5EgyP3pSKypW
Ph0hiP5wYrc=
=L6hJ
-----END PGP SIGNATURE-----

--=-b6utnWCS15VlnOe3728l--