So I have an IOCP project with a SocketAsyncEventArgs
pool that makes them re-usable and reduces the heavy allocation task of SocketAsyncEventArgs.
I assume that when the SocketAsyncEventArgs.Completed event gets invoked, staying re-usable(not disposed), the Completed event hooked in chain will not be automatically set to null. Therefore, I have to manually clean up the event, if I do not want the specific event to be fired multiple times.
Is my assumption about SocketAsyncEventArgs.Completed correct? or is it somewhat internally managed?
The code below might explain more clearly:
void Foo(SocketAsyncEventArgs e) // Call-back
{
DoJob(e);
// Should I do it?
// e.Completed -= Foo;
}
Thanks in advance.