[Vortex] Question about ausage pattern

Jens Alfke jens at mooseyard.com
Sun Mar 30 18:58:49 CEST 2008

On 30 Mar '08, at 8:11 AM, Robert M. Münch wrote:

> Now the question is, the initiator uses a frame-recieved handler to  
> write
> the recieved data. But, how to get either the filename or the  
> filepointer
> to this handler? I don't want to use globals because there can be more
> than one file transfer at the same time, vortex is threaded etc.

Every outgoing message is assigned a message number when it's sent;  
and every incoming frame contains the message number that it's  
replying to.

So when you send a request, use a per-channel dictionary to associate  
its message number with whatever auxiliary data you need to remember.  
Then when a reply arrives, look up what channel it's in, get the  
dictionary, then use the original-message number to look up the  
auxiliary data.

In my framework the auxiliary data is a pointer to a user-supplied  
"message delegate" object, and the incoming reply is sent along to a  
replyReceived method on that delegate.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1875 bytes
Desc: not available
Url : http://lists.aspl.es/pipermail/vortex/attachments/20080330/244f28cb/attachment.bin 

More information about the Vortex mailing list