示例#1
0
void
kbdinput::output (str s)
{
  suio_print (&outq, s);
  if (outq.resid ()) {
    fdcb (kbdfd, selread, NULL);
    fdcb (kbdfd, selwrite, wrap (this, &kbdinput::writecb));
  }
}
bool
authcursor_file_append::update ()
{
  if (wfd < 0)
    return false;
  str astr = authdbrec2str (&ae);
  if (!astr)
    return false;
  str k = aekey (ae);
  if (keys[k]) {
    warn << "duplicate: " << astr << "\n";
    return false;
  }
  keys.insert (k);
  suio_print (&buf, astr);
  buf.print ("\n", 1);
  if (buf.resid () >= 8192)
    buf.output (wfd);
  return true;
}
示例#3
0
文件: tcpproxy.C 项目: bougyman/sfs
void
sfssrv_proxy::mkproxy (ref<bool> dest, int cfd, str data, svccb *sbp, int sfd)
{
    if (*dest) {
        sbp->replyref (sfs_connectres (SFS_TEMPERR));
        close (cfd);
        close (sfd);
        return;
    }
    if (sfd < 0) {
        warn << host << ":" << port << ": " << strerror (errno) << "\n";
        sbp->replyref (sfs_connectres (SFS_TEMPERR));
        close (cfd);
        return;
    }
    sbp->ignore ();
    proxy *pp = New proxy (cfd, sfd);
    proxies.insert_head (pp);
    suio_print (&pp->con[1].wbuf, data);
    pp->setcb (1);
}