Hi,

thank you very much for that remind me that thread. It works quite well
with shared_ptr. However, I still a one issue: I get this error: WARN
tntnet.worker - sending failed. I am using directMode for streaming and
this code snippet for writing the contents to the stream:

    size_t from = 0, to = 0, contentLength = streamer->GetContentLength(),
length = contentLength;
    bool hasRange = false;
    [...]
    if(hasRange && streamer->Seekable() && contentLength > 0){
      if(!streamer->Seek(from, SEEK_SET)){
        return HTTP_INTERNAL_SERVER_ERROR;
      }
      code = HTTP_PARTIAL_CONTENT;
    }

    reply.setDirectMode(code);

    size_t bytesRead = 0;
    char buffer[KB(16)];
    while ((bytesRead = streamer->Read(buffer, KB(16))) > 0 && length) {
      reply.out().write(buffer, bytesRead);
      length -= bytesRead;
      if (!reply.out()) {
        code = HTTP_GONE;
        break;
      }
    }

from, to and hasRange are calculated from range header (Range:
bytes=xxx-yyy).

What does the warning mean?

Thank you again for your help.

2012/10/23 ArtemGr <[email protected]>

> Denis Loh <denis.loh@...> writes:
> > Hi,
> >
> > I want to stream a video with partial content (206 Partial Content) and
> > set the DirectMode to 206. However, can I close the file I have opened
> > when the request was stopped or canceled? Is there a possibility to add
> > this function call to a special "onClose" scope?
> >
> > Thanks
> >
> > Denis
>
> Hi, Denis!
>
> You should be able to close the file
> from a destructor of a struct instantiated in a request scope.
> See this thread:
> http://thread.gmane.org/gmane.comp.web.server.tntnet/737/focus=758
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> _______________________________________________
> Tntnet-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/tntnet-general
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to