MCPcopy Create free account
hub / github.com/LUX-Core/lux / ChannelPut2

Method ChannelPut2

src/cryptopp/mqueue.cpp:84–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84size_t EqualityComparisonFilter::ChannelPut2(const std::string &channel, const byte *inString, size_t length, int messageEnd, bool blocking)
85{
86 if (!blocking)
87 throw BlockingInputOnly("EqualityComparisonFilter");
88
89 unsigned int i = MapChannel(channel);
90
91 if (i == 2)
92 return Output(3, inString, length, messageEnd, blocking, channel);
93 else if (m_mismatchDetected)
94 return 0;
95 else
96 {
97 MessageQueue &q1 = m_q[i], &q2 = m_q[1-i];
98
99 if (q2.AnyMessages() && q2.MaxRetrievable() < length)
100 goto mismatch;
101
102 while (length > 0 && q2.AnyRetrievable())
103 {
104 size_t len = length;
105 const byte *data = q2.Spy(len);
106 len = STDMIN(len, length);
107 if (memcmp(inString, data, len) != 0)
108 goto mismatch;
109 inString += len;
110 length -= len;
111 q2.Skip(len);
112 }
113
114 q1.Put(inString, length);
115
116 if (messageEnd)
117 {
118 if (q2.AnyRetrievable())
119 goto mismatch;
120 else if (q2.AnyMessages())
121 q2.GetNextMessage();
122 else if (q2.NumberOfMessageSeries() > 0)
123 goto mismatch;
124 else
125 q1.MessageEnd();
126 }
127
128 return 0;
129
130mismatch:
131 return HandleMismatchDetected(blocking);
132 }
133}
134
135bool EqualityComparisonFilter::ChannelMessageSeriesEnd(const std::string &channel, int propagation, bool blocking)
136{

Callers 3

Put2Function · 0.45
TransferTo2Method · 0.45
ChannelPut2Function · 0.45

Calls 10

BlockingInputOnlyClass · 0.85
OutputClass · 0.85
AnyMessagesMethod · 0.80
AnyRetrievableMethod · 0.80
MessageEndMethod · 0.80
MaxRetrievableMethod · 0.45
SpyMethod · 0.45
SkipMethod · 0.45
PutMethod · 0.45
GetNextMessageMethod · 0.45

Tested by

no test coverage detected