示例#1
0
void TestNrSocket::fire_readable_callback() {
  MOZ_ASSERT(poll_flags() & PR_POLL_READ);
  // Stop listening on all mapped sockets; we will start listening again
  // if the app starts listening to us again.
  cancel_port_mapping_async_wait(NR_ASYNC_WAIT_READ);
  r_log(LOG_GENERIC, LOG_DEBUG, "TestNrSocket %s ready for read",
        my_addr_.as_string);
  fire_callback(NR_ASYNC_WAIT_READ);
}
示例#2
0
int TestNrSocket::cancel(int how) {

  r_log(LOG_GENERIC, LOG_DEBUG, "TestNrSocket %s stop waiting for %s",
        internal_socket_->my_addr().as_string,
        how == NR_ASYNC_WAIT_READ ? "read" : "write");

  // Writable callbacks are decoupled except for the TCP case
  if (how == NR_ASYNC_WAIT_READ ||
      internal_socket_->my_addr().protocol == IPPROTO_TCP) {
    cancel_port_mapping_async_wait(how);
  }

  return internal_socket_->cancel(how);
}
示例#3
0
int TestNrSocket::cancel(int how) {
  ASSERT_ON_THREAD(ststhread_);

  r_log(LOG_GENERIC, LOG_DEBUG, "TestNrSocket %s stop waiting for %s",
        my_addr_.as_string,
        how == NR_ASYNC_WAIT_READ ? "read" : "write");

  // Writable callbacks are decoupled except for the TCP case
  if (how == NR_ASYNC_WAIT_READ || my_addr_.protocol == IPPROTO_TCP) {
    cancel_port_mapping_async_wait(how);
  }

  return NrSocket::cancel(how);
}