Closed nemanja-boric-sociomantic closed 5 years ago
Currently, RequestOnConnBase.receive passes the received data to the receive callback delegate as in void[] data (https://github.com/sociomantic-tsunami/swarm/blob/f337984496e0f08d08f4be5997b4272d9c0e0dab/src/swarm/neo/connection/RequestOnConnBase.d#L1029). This prevents the user changing this slice, so the user needs to do Const!(void)[] payload_slice = payload in order to be able to pass the data trough the MessageParser.get* methods, for example.
RequestOnConnBase.receive
in void[] data
Const!(void)[] payload_slice = payload
MessageParser.get*
There's no need that the entire slice stay constant, it's has the scope of the delegate and it can safely be non-const. However, the data it points to should stay const, so it would be better if the delegate had the following signature:
void receive (Const(void)[] data)
Fixed in #397.
Currently,
RequestOnConnBase.receive
passes the received data to the receive callback delegate asin void[] data
(https://github.com/sociomantic-tsunami/swarm/blob/f337984496e0f08d08f4be5997b4272d9c0e0dab/src/swarm/neo/connection/RequestOnConnBase.d#L1029). This prevents the user changing this slice, so the user needs to doConst!(void)[] payload_slice = payload
in order to be able to pass the data trough theMessageParser.get*
methods, for example.There's no need that the entire slice stay constant, it's has the scope of the delegate and it can safely be non-const. However, the data it points to should stay const, so it would be better if the delegate had the following signature: