If a reader is detected there is no need to test it further, just set a boolean.
This commit is contained in:
parent
878b742558
commit
a9615869e3
@ -157,18 +157,20 @@ SG_DDS::write( const char *buf, const int length )
|
||||
return 0;
|
||||
}
|
||||
|
||||
dds_return_t rc;
|
||||
uint32_t status = 0;
|
||||
rc = dds_get_status_changes(writer, &status);
|
||||
if (!status)
|
||||
{
|
||||
dds_return_t rc = dds_get_status_changes(writer, &status);
|
||||
if (rc != DDS_RETCODE_OK) {
|
||||
SG_LOG(SG_IO, SG_ALERT, "dds_get_status_changes: "
|
||||
<< dds_strretcode(-rc));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(status & DDS_PUBLICATION_MATCHED_STATUS)) {
|
||||
SG_LOG(SG_IO, SG_INFO, "DDS skipping write: no readers.");
|
||||
return length; // no readers yet.
|
||||
}
|
||||
}
|
||||
|
||||
result = dds_write(writer, buf);
|
||||
if(result != DDS_RETCODE_OK)
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
const dds_topic_descriptor_t *descriptor = nullptr;
|
||||
size_t packet_size = 0;
|
||||
|
||||
int timeout = 0;
|
||||
uint32_t status = 0;
|
||||
|
||||
dds_entity_t participant = -1;
|
||||
dds_entity_t topic = -1;
|
||||
@ -75,9 +75,6 @@ public:
|
||||
|
||||
// close the participant.
|
||||
bool close();
|
||||
|
||||
// set timeout (default: 0)
|
||||
inline void set_timeout(int i) { timeout = i; }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user