On Wed, Oct 22, 2008 at 8:58 PM, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
> Stephen Deasey wrote:
>> On Wed, Oct 22, 2008 at 9:03 PM, Vlad Seryakov <[EMAIL PROTECTED]> wrote:
>>> I tried to use Ns_SockSendBufs() but it sends data directly to socket
>>> where i need to send via driver's send proc.
>>
>>
>> Just pass your Send() proc directly, and delete SendBufs():
>>
>>  static ssize_t
>>  SendFile(Ns_Sock *sock, Ns_FileVec *bufs, int nbufs, Ns_Time
>> *timeoutPtr, int flags)
>>  {
>> -    return Ns_SockSendFileBufsIndirect(sock->sock, bufs, nbufs,
>> timeoutPtr, flags, SendBufs);
>> +    return Ns_SockSendFileBufsIndirect(sock->sock, bufs, nbufs,
>> timeoutPtr, flags, Send);
>>  }
>>
>>
>>> Why connPtr->nContentSent is not updated, all send called with conn
>>> parameters should do this
>>
>>
>> Yes, but Ns_ConnSend() is higher up the stack, so when sending data it
>> looks something like this:
>>
>> return.c: Ns_ConnReturnData
>> connio.c: Ns_ConnWriteData
>> connio.c: Ns_ConnWriteVData
>> connio.c: Ns_ConnSend
>> driver.c: NsDriverSend
>> nsssl/nsssl.c: Send
>>
>>
>> By the time your Send() is called we've already passed through
>> Ns_ConnSend(). nContentSent will be updated as the stack unwinds.
>>
>> If you call Ns_ConnSend() from within Send(), that's a loop...
>>
>
> The first argument is different, Ns_Sock vs SOCKET
>


Fixed. For SSL (and for all drivers) just leave sendfFileProc as NULL
and your sendProc will be called as needed to send file/buffer chunks.

If you were writing something like an FTP server, then you would want
to copy nssock and call Ns_SockSendFileBufs to optimise the
reading-from-disk/writing-to-network. Leaving it NULL will always be
correct though.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to