-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hey !
When making identical stream requests it appears the same stream id is returned and a single update is sent with each StreamUpdate instead of two. The behavior seems to be the same whether these requests are made in distinct packets or together in a batch.
For example, using the client I'm working on:
let stream1 = client.mk_call(&krpc_mars::mk_stream(&space_center::get_ut()))?;
let stream2 = client.mk_call(&krpc_mars::mk_stream(&space_center::get_ut()))?;
let update = stream_client.recv_update()?;
println!("Stream1: {:?}", stream1);
println!("Stream2: {:?}", stream2);
println!("update: {:?}", update);Produces:
Stream1: StreamHandle { stream_id: 41, ... }
Stream2: StreamHandle { stream_id: 41, ... }
update: StreamUpdate { updates: {41: value: "\211\355\013\207\006*\326@"} }
This could be a problem when those streams are created by independent parts of the client program and one of them decides it no longer needs the stream and removes it. When that happens, the stream disappears for both of them.
I believe this behavior is intended to minimize the amount of data sent to the client. Maybe a counter could be added server-side so that in the above scenario two calls to RemoveStream are necessary to completely remove the stream.