summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxant <xant@dyne.org>2012-12-10 17:18:17 (GMT)
committer xant <xant@dyne.org>2012-12-10 17:18:17 (GMT)
commit3860332007c1ce801b08f6107534bbc74df52046 (patch)
tree019d5f4f667c36c30e9c6d858c9f74c96559ea63
parentd43cd1c33b1fbe0772c070467a35def7d487b118 (diff)
allow to provide a signal signature to use to provide passive data from outputpin
-rw-r--r--core/JMXPin.mm21
1 files changed, 13 insertions, 8 deletions
diff --git a/core/JMXPin.mm b/core/JMXPin.mm
index 4f52584..ce5ab55 100644
--- a/core/JMXPin.mm
+++ b/core/JMXPin.mm
@@ -190,12 +190,17 @@ using namespace v8;
// check if we should use a different read mode (depending on our owner capabilities)
if (owner) {
- SEL signal = NSSelectorFromString(self.label);
- if ([owner respondsToSelector:signal]) {
+ if (pinSignal && [self isKindOfClass:[JMXOutputPin class]]) {
readMode = kJMXPinReadModeOwnerSelector;
- readSignal = signal;
- } else if ([owner conformsToProtocol:@protocol(JMXPinOwner)]) {
- readMode = kJMXPinReadModeOwnerProtocol;
+ readSignal = NSSelectorFromString(pinSignal);
+ } else {
+ SEL signal = NSSelectorFromString(self.label);
+ if ([owner respondsToSelector:signal]) {
+ readMode = kJMXPinReadModeOwnerSelector;
+ readSignal = signal;
+ } else if ([owner conformsToProtocol:@protocol(JMXPinOwner)]) {
+ readMode = kJMXPinReadModeOwnerProtocol;
+ }
}
}
@@ -587,14 +592,14 @@ using namespace v8;
// if instead new data arrived, check if it's of the correct type
// and propagate the signal if that's the case
if ([self isValidData:data]) {
- id currentData = nil;
+ id toRelease = nil;
UInt32 currentOffset = offset&kJMXPinDataBufferMask;
UInt32 nextOffset = (offset+1)&kJMXPinDataBufferMask;
- currentData = dataBuffer[currentOffset];
+ toRelease = dataBuffer[nextOffset];
dataBuffer[nextOffset] = [data retain];
OSAtomicIncrement32(&offset);
dataBuffer[currentOffset] = nil;
- [currentData autorelease];
+ [toRelease release];
if (sender)
currentSender = sender;
else