in src/main/csharp/Connection.cs [182:207]
internal ZmqSocket GetProducer()
{
ProducerRef producerRef;
string contextBinding = GetProducerContextBinding();
lock(producerCacheLock)
{
if(!producerCache.TryGetValue(contextBinding, out producerRef))
{
producerRef = new ProducerRef();
producerRef.producer = this.Context.CreateSocket(SocketType.PUB);
if(null == producerRef.producer)
{
throw new ResourceAllocationException();
}
producerRef.producer.Bind(contextBinding);
producerCache.Add(contextBinding, producerRef);
}
else
{
producerRef.refCount++;
}
}
return producerRef.producer;
}