0

The feed created by push_list_add() will be terminted whenever the client or the server close the connection.
But how can I close a connection in server side?
What exactly I need is a way to remove a feed which is created by push_list_add().
Who can tell how to remove a push list (or a feed) programmatically, in gwan?

thx in advance.

Gil
  • 3,279
  • 1
  • 15
  • 25
k.k. lou
  • 1,805
  • 2
  • 13
  • 16

1 Answers1

0

In the callback used to generate the data to push, you can implement any mechanism you wish to stop pushing at any given time or when the data to push is exhausted.

A simple return(0) from make_fn() or push_fn() will do the job.

The free_fn() callback then allows you to release any allocated data, close file descriptors established with a backend, etc.

See the comet.c example for details.

Gil
  • 3,279
  • 1
  • 15
  • 25
  • I think I have mis-interpreted the function name of push_list_add. – k.k. lou Jul 04 '13 at 12:14
  • I guess/interpret this function is to add a connection into the connection list for pushing data to clients. So, if I put a return(0) in make/push_fn will close the list, but not a specific connection. What I want to achieve is to close/remove a connection from the connection list. – k.k. lou Jul 04 '13 at 12:18
  • Just call close(fd); when you feel it's needed. Your code will go in the push_fn() callback – Gil Jul 08 '13 at 13:22