"is_connected" should be used to judge whether have built a successful
connection with peer. Since "pipe == NULL" is useless for whether connected
because pipe can be construct without any potential network problem
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
return static_cast<Pipe*>(RefCountedObject::get());
}
+ bool is_connected() {
+ Mutex::Locker l(pipe_lock);
+ return state == STATE_OPEN;
+ }
+
char *recv_buf;
int recv_max_prefetch;
int recv_ofs;
pipe = p->get();
}
+bool PipeConnection::is_connected() {
+ Mutex::Locker l(lock);
+ if (pipe)
+ return pipe->is_connected();
+ return false;
+}
+
int PipeConnection::send_message(Message *m)
{
assert(msgr);
void reset_pipe(Pipe* p);
- bool is_connected() {
- Mutex::Locker l(lock);
- return pipe != NULL;
- }
+ bool is_connected();
int send_message(Message *m);
void send_keepalive();