>
> On Thu, Sep 15, 2011 at 2:57 PM, Christian Grothoff
>
> <
address@hidden>wrote:
> > Eh, MHD_connection_close is NOT part of the public API for good reasons.
> >
> > You MUST not use it, the symbol is not even exported by the library.
> >
> > Getting segmentation faults from using it yourself is expected. Do not
> > do that.
> >
> > Also, I am getting more an more confused about what you're trying to do.
> > Naturally you CAN get two connections from the same source IP address at
> > the same time, and your server should support that (otherwise it is
> > simply broken). MHD has no problem handling more than one connection
> > per IP at a time either.
> >
> >
> > I currently can only conclude that you're trying to do something with IP
> > addresses that you should manage with sessions/cookies and that your
> > application logic is most likely severely broken (based on not
> > understanding TCP/IP and/or HTTP) and thus you're trying to do these
> > strange things and come up with odd requirements like the 'instant'
> > cleanup on connection closure.
> >
> > TCP-FIN is not 'instant' and a browser may send us a TCP-SYN before we
> > get the FIN, right? Not to mention, what would your system do with two
> > users behind NAT using the same IP address?
> >
> > With SVN HEAD, MHD is now calling the response destroy handler (as well
> > as the 'connection completed' handlers) as soon as the OS tells us that
> > the connection is dead. More cannot be done, and mucking around with
> > MHD internals is not going to improve the situation. Also, you should
> > NEVER EVER store a 'struct MHD_Connection' in your own data structures,
> > that's virtually always a bug. Instead, store a pointer to your data
> > structures in the 'void**' you're provided by MHD.
> >
> > Happy hacking!
> >
> > Christian
> >
> > On 09/15/2011 09:15 AM, Regis Louge wrote:
> >> Hi,
> >>
> >> I have updated my version to the 0.9.14 that contains this patch
> >> (without compilation error :) ). I managed to handle the disconnection
> >> reconnection of the client by storing the MHD_Connection in my structure
> >> and closing it manually whenever a call on "/push" is made from the same
> >> IP address and a previous connection was stored :
> >>
> >> if(client->connection != NULL)
> >> MHD_connection_close(client->**connection,
> >> MHD_REQUEST_TERMINATED_WITH_**ERROR);
> >> client->connection = connection;
> >>
> >> Now I encounter something really weird, indeed, if a client disconnects,
> >> I can "send" him a push notification without anything happening on my
> >> web server, but when I "send" him a second one I have this weird
> >> segmentation fault in :
> >>
> >> int MHD_connection_handle_write (struct MHD_Connection *connection)
> >>
> >> |_switch (connection->state)
> >> |
> >> |_case MHD_CONNECTION_CHUNKED_BODY_**READY:
> >> |_check_write_done (connection,
> >> |
> >> (connection->response->total_**size ==
> >>
> >> connection->response_write_**position) ?
> >>
> >> MHD_CONNECTION_BODY_SENT :
> >> MHD_CONNECTION_CHUNKED_BODY_**UNREADY);
> >>
> >> It is right after the connection closes so connection->state is supposed
> >> to be MHD_CONNECTION_CLOSED ?
> >>
> >> Any idea what that would happen ? And why does the first push
> >> notification attempt don't fail ?
> >>
> >> Thanks a lot
> >>