still FbRemoteEvent

View: New views
3 Messages — Rating Filter:   Alert me  

still FbRemoteEvent

by paha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jiri,

is it possible to somehow  implement an IDisposable pattern for FbRemoteEvent? There are a lot of small problems now. For instance:
if i pass an connection object to the FbRemoteEvent constructor there are as far as i understand two possibilities
1) i as owner responsible for destroying this connection object - doesn't work for now, if i dispose connection, there is a socket exception, cause RemoteEvent still tries to read from already disposed stream
2) FbRemoteEvent should destroy it  - i didn't find any place in code, where FbRemoteEvent would manage connection dispose. As i understand, you cannot stop it from listening at all. the thread, that is reading responses from server is declared "background" and reads until owning window is destroyed (and causes bunch of ThreadAbortedException's)

to understand the problem, consider this test case

FbConnection conn1 = new FbConnection("");            
conn1.Open();
revent = new FbRemoteEvent(conn1, new[] { "event" });
revent.RemoteEventCounts += revent_RemoteEventCounts;
revent.QueueEvents();

revent.CancelEvents();
revent.RemoteEventCounts -= revent_RemoteEventCounts;
revent.Connection = null;
//this will cause an socket exception
conn1.Dispose();

Is there any possibility to implement some Stop method (that causes stoppage of all socket/thread stuff)  - in my opinion  - CancelEvents might do this work. And it would be nice to know, that the same functionality (and also dispose of connection) would be done in Dispose method. We can still dispose connection on our own, but only if we can stop socket listening (and this must be clearly stated in docu).

Re: still FbRemoteEvent

by Jiri Cincura :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 23, 2008 at 11:58 AM, paha <ch_pasha@...> wrote:

>
> Hi Jiri,
>
> is it possible to somehow  implement an IDisposable pattern for
> FbRemoteEvent? There are a lot of small problems now. For instance:
> if i pass an connection object to the FbRemoteEvent constructor there are as
> far as i understand two possibilities
> 1) i as owner responsible for destroying this connection object - doesn't
> work for now, if i dispose connection, there is a socket exception, cause
> RemoteEvent still tries to read from already disposed stream
> 2) FbRemoteEvent should destroy it  - i didn't find any place in code, where
> FbRemoteEvent would manage connection dispose. As i understand, you cannot
> stop it from listening at all. the thread, that is reading responses from
> server is declared "background" and reads until owning window is destroyed
> (and causes bunch of ThreadAbortedException's)
>
> to understand the problem, consider this test case
>
> FbConnection conn1 = new FbConnection("");
> conn1.Open();
> revent = new FbRemoteEvent(conn1, new[] { "event" });
> revent.RemoteEventCounts += revent_RemoteEventCounts;
> revent.QueueEvents();
>
> revent.CancelEvents();
> revent.RemoteEventCounts -= revent_RemoteEventCounts;
> revent.Connection = null;
> //this will cause an socket exception
> conn1.Dispose();
>
> Is there any possibility to implement some Stop method (that causes stoppage
> of all socket/thread stuff)  - in my opinion  - CancelEvents might do this
> work. And it would be nice to know, that the same functionality (and also
> dispose of connection) would be done in Dispose method. We can still dispose
> connection on our own, but only if we can stop socket listening (and this
> must be clearly stated in docu).

Hello,

can you post request to tracker to ability to stop all socket
operations for events. Thanks.

--
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

-------------------------------------------------------------------------
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=/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@...
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Re: still FbRemoteEvent

by paha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sure, consider it done ;)