Back to the main page.

Bug 748 - close buffer cleanly

Status ASSIGNED
Reported 2011-06-09 11:04:00 +0200
Modified 2014-11-13 09:52:20 +0100
Product: FieldTrip
Component: realtime
Version: unspecified
Hardware: PC
Operating System: All
Importance: P2 enhancement
Assigned to: Robert Oostenveld
URL:
Tags:
Depends on:
Blocks: 1395
See also:

- 2011-06-09 11:04:43 +0200

Created attachment 74 contains buffer.h, extern.h/.c, tcpserver.c and tcpsocket.c These modifications allow to run a new buffer after closing one, in the same process. added : -two global variables and there mutexes in extern.h/.c -function close_tcpserver that closes all sockets, then the tcpserver. I wonder if closing all the sockets can cause problems (e.g. if there is a client in the same process), but I did not observe it. Is this solution good ?


jean - 2012-02-28 16:37:20 +0100

Hi, Is there any plan to have this patch be integrated in fieldtrip repository? We'd like to know when we can remove the patched code we have here. Thanks in advance Jean


Boris Reuderink - 2012-03-02 13:23:01 +0100

Dear Amelie and Jean, Could one of you explain why this patch is needed? I don't quite understand what new functionality is provided. Best, Boris


jean - 2012-03-02 13:29:21 +0100

Hi Boris, We compiled a fieldtrip buffer library. From a main program, we instanciate a fieldtrip server. As we let user change the port used for connection, we need to have a way to stop and restart the server cleanly. The patch Amelie provided makes it possible to do so. Without the patch, the only way to stop the server was to kill its thread. Then, some objects are not released cleanly and trying to instantiate a new server leads to behavioural problems. Jean


Boris Reuderink - 2012-03-09 10:40:18 +0100

Thank you for your elaboration. We discussed the proposal, and we definitely want to include this functionality! It might take some time however, since the mutex use in the buffer were recently improved --- so we have to be careful that this patch is applied cleanly. Best, Boris


jean - 2012-03-09 11:58:24 +0100

OK good, I'll wait then ;-) Thank you Jean


Philip van den Broek - 2012-03-13 09:26:38 +0100

Do you think a possible solution for this bug would also solve bug 934? Running on a mac, sometimes Matlab crashes when clear buffer is executed. However, on winXP/win7 the Matlab session always freezes after executing ft_destroy_buffer(). Gr. Philip


jean - 2012-03-13 09:33:20 +0100

Hi, Sorry, but I can't tell, I'm not using Matlab at all (I am only working with C++ programs). Jean


Boris Reuderink - 2012-11-02 13:29:52 +0100

I am no longer working on FieldTrip. Hence, I donate all my bugs to the joint development user.


Robert Oostenveld - 2013-01-24 12:29:04 +0100

I changed a bunch of bugs that were assigned to fieldtrip-bugs from ASSIGNED into NEW, since nobody is now explicitly working on them.


Arjen Stolk - 2014-11-12 15:55:43 +0100

This seems an old 'bug'. Is this still actual? And still worth implementing?


jean - 2014-11-13 09:52:20 +0100

Yes, I see this is still the present in your latest code. There is a function to create a TCP server (tcpserver), but there is no function to destroy/close it. Then, the same process cannot create one, destroy it and then create a new one.