Hi,
TMessage seems to be a bit unappropriate for routing messages because it
requires transitions from read<->write. Once you have a message in read
mode it is a bit of a nightmare to send it to another consumer. The root
of the problem is in skipping the sizeof(UInt_t) in constructor for
TMessage in read mode (as called from TSocket::Recv). I modified the
relevant code in TSocket and TMessage (just some 4 lines or so) to keep
these extra bytes and write the true length of received message into them.
Now i feel tempted to write sth like
Int_t
TMessage::PrepareToSend() {
if(IsReading()) {
UInt_t len = *((UInt_t*)fBuffer);
if(len==0) return 1; // die horribly if len==0
fBufCurr = fBuffer + len + sizeof(UInt_t);
SetWriteMode();
}
return 0;
}
+ sth equiv for PrepareToRead()
Is there a chance to get this into official distribution?
After all ... sparing 4(or 8) bytes is not that great ... especially with
minimum buffer size = 128b. (at first i thought it is optimised for null
messages ... when just What() matters)
Am i missing a point here?
Cheers,
matevz
--
---------------------------------------------------
Matevz Tadel, E-mail: Matevz.Tadel@ijs.si
Department of Experimental High Energy Physics F9
Jozef Stefan Institute, Jamova 39, P.o.Box 3000
SI-1001 Ljubljana, Slovenia
Tel.: +386-61-177-3674 Fax: +386-61-125-7074
---------------------------------------------------
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET