After this patch is applied, if the cache buffer is not empty, the
rpc-port library checks the socket whether writing is possible or not.
If it's possible, the rpc-port library writes the delayed message to
the socket fd.
Change-Id: If54967bbc7fce4d4494b9fee44d8dcfe5e57de50
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
return RPC_PORT_ERROR_NONE;
else if (ret == PORT_STATUS_ERROR_IO_ERROR)
return RPC_PORT_ERROR_IO_ERROR;
return RPC_PORT_ERROR_NONE;
else if (ret == PORT_STATUS_ERROR_IO_ERROR)
return RPC_PORT_ERROR_IO_ERROR;
- }
-
- if (delayed_message_size_ > QUEUE_SIZE_MAX) {
- _E("cache fail : delayed_message_size (%d), count(%zu)",
- delayed_message_size_, queue_.size());
- return RPC_PORT_ERROR_IO_ERROR;
- }
-
- ret = PushDelayedMessage(
- std::make_shared<DelayMessage>(static_cast<const char*>(buf),
- sent_bytes, size));
-
- if (CanWrite()) {
+ } else if (CanWrite()) {
while (!queue_.empty()) {
int port_status = PopDelayedMessage();
if (port_status != PORT_STATUS_ERROR_NONE) {
while (!queue_.empty()) {
int port_status = PopDelayedMessage();
if (port_status != PORT_STATUS_ERROR_NONE) {
+ if (delayed_message_size_ > QUEUE_SIZE_MAX) {
+ _E("cache fail : delayed_message_size (%d), count(%zu)",
+ delayed_message_size_, queue_.size());
+ return RPC_PORT_ERROR_IO_ERROR;
+ }
+
+ return PushDelayedMessage(
+ std::make_shared<DelayMessage>(
+ static_cast<const char*>(buf), sent_bytes, size));
}
int Port::Write(const void* buf, unsigned int size, int* sent_bytes) {
}
int Port::Write(const void* buf, unsigned int size, int* sent_bytes) {
return G_SOURCE_REMOVE;
}
return G_SOURCE_REMOVE;
}
+ _W("Writing is now possible. fd: %d, id: %s",
+ port->GetFd(), port->GetId().c_str());
std::lock_guard<std::recursive_mutex> lock(port->rw_mutex_);
if (port->source_id_ == 0) {
_E("GSource is destroyed");
std::lock_guard<std::recursive_mutex> lock(port->rw_mutex_);
if (port->source_id_ == 0) {
_E("GSource is destroyed");