Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > IFWXSocket are reused by ISA?
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 15th April 22:33
byte
External User
 
Posts: 1
Default IFWXSocket are reused by ISA?



Hi! Sorry for my English - I from Russia.

IFWXSocket are reused by ISA with different datafilters?

In SetSockets I call _AddRef of sockets and save reference to the sockets.
When my datafilter is detached, I call _Release method of sockets. All
fine works - my datafilter is destroyed, but later in system journal
appears message about access violation and Firewall service is down!

If I call _AddRef in SetSockets and don't call _Release in Detach method -
all works fine, but memory leak...

Anybody can help me? How I can be notified, when I can release reference
to the IFWXSocket's?
  Reply With Quote


  sponsored links


2 15th April 22:33
jesse
External User
 
Posts: 1
Default IFWXSocket are reused by ISA?



Привет. Да тут почти все говорят по-русски
Но отвечу на интернациональном, чтобы все понимали.

by ISA SDK:
"IFWXDataFilter:etach Method
Detaches a data filter. When a data filter is detached it must release the
references it holds to the socket interfaces and to the connection."

So you do the right thing. You should also synhchronize access to socket
usng critical sections.
Check ISA SDK sample DbgDump - it shows the right way for TCP filtering.

--------------
Jesse
  Reply With Quote
3 15th April 22:34
byte
External User
 
Posts: 1
Default Remarks


Some remark: this problem appears only for Firewal clients.
For NAT clients all OK
  Reply With Quote
4 15th April 22:34
byte
External User
 
Posts: 1
Default IFWXSocket are reused by ISA?


Thank's for reply.
More remarks:
1. I develop application filter for ISA 2004;
2. I use critical section for synchronizing;
3. I do not destroy datafilter, while CountOfSocketsReads less, than
CompleteAsyncIOCalls;

Why this problem appear only for Firewall clients, but not for NAT
clients?
  Reply With Quote
5 21st April 10:06
yosef dinerstein
External User
 
Posts: 1
Default IFWXSocket are reused by ISA?


There is probably a race between Detach() method and your other functions.
You need to debug the problem and to unilize it correctly.

A few hints to write your filter correctly:

- Upon SetSockets() you should store the pointers to the sockets and call
AddRef as you did.
- In Detach() you should set NULL in members that stored those pointers to
the sockets and you should release the reference (that was a correct thing
to do).
- You should protect members, for example with critical section.
For example,


Class *** : public IFWXDataFilter

{

....

IFWXSocket * m_p1;

....

***(): m_p1(NULL) {

...

}

....

};

***::SetSockets(IFWXSocket * p1, ...)

{

...

p1->AddRef();

Lock();

ASSERT(NULL == m_p1);

m_p1 = p1;

Unlock();

...

}

***:etach()

{

IFWXSocket * p1 = NULL;

...

Lock();

p1 = m_p1;

m_p1 = NULL;

Unlock();

if (p1) {

p1->Release();

}

...

}

***::AnyOtherFunction()

{

IFWXSocket * p1 = NULL;

...

Lock();

if (m_p1) {

p1 = m_p1;

p1->AddRef();

}

Unlock();

// safely use p1 if it is not NULL

...

}
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright ╘ 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666