MCPcopy Create free account
hub / github.com/COVESA/vsomeip / send

Method send

implementation/endpoints/src/local_endpoint.cpp:155–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155bool local_endpoint::send(byte_t const* _data, uint32_t _size) {
156 std::scoped_lock const lock{mutex_};
157 if (is_flushing_) {
158 VSOMEIP_WARNING_P << "Dropping message type: " << protocol::read_command_id(_data, _size) << " and size: " << _size
159 << ", due to the current state: " << status_unlock();
160 return false;
161 }
162 if (std::numeric_limits<size_t>::max() - _size < send_queue_.size()) {
163 VSOMEIP_ERROR_P << "Dropping message type: " << protocol::read_command_id(_data, _size) << " and size: " << _size
164 << ", to avoid buffer overflow, " << status_unlock();
165 return false;
166 }
167 // Note: _size + send_queue_.size() could oveflow,
168 // Note 2:
169 // 1. Assume: If send_queue_ is not greater then the queue_limit_ after the n-th call,
170 // then the next check ensures that the send_queue_.size() will be not greater then the queue_limit_
171 // after the n+1-th call
172 // 2. send_queue_.size() starts with 0 -> queue_limit_ is not smaller then send_queue_.size() after n = 0
173 // 1. + 2. => the next line can never cause trouble
174 if (queue_limit_ != QUEUE_SIZE_UNLIMITED && queue_limit_ - send_queue_.size() < _size) {
175 VSOMEIP_ERROR_P << "Dropping message of type: " << protocol::read_command_id(_data, _size) << ", because the queue limit ("
176 << queue_limit_ << ") would be exceeded with the message size: " << _size << ", " << status_unlock();
177 return false;
178 }
179 if (max_message_size_ < _size) {
180 VSOMEIP_ERROR_P << "Dropping message of type: " << protocol::read_command_id(_data, _size) << " because the message size (" << _size
181 << ") exceeded the limit (" << max_message_size_ << "), " << status_unlock();
182 return false;
183 }
184 send_queue_.insert(send_queue_.end(), _data, _data + _size);
185 send_unlock();
186 return true;
187}
188
189template<typename T>
190bool local_endpoint::send(T const& _in) {

Callers 4

broadcast_locallyMethod · 0.45
create_routing_clientMethod · 0.45
add_connectionMethod · 0.45

Calls 9

read_command_idFunction · 0.85
wire_sizeFunction · 0.85
get_idFunction · 0.85
serializeFunction · 0.85
insertMethod · 0.80
endMethod · 0.80
resizeMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected