ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/send.c
(Generate patch)

Comparing ircd-hybrid-7.2/src/send.c (file contents):
Revision 34 by lusky, Sun Oct 2 21:05:51 2005 UTC vs.
Revision 438 by michael, Sat Feb 11 21:53:46 2006 UTC

# Line 91 | Line 91 | send_format(char *lsendbuf, int bufsize,
91   }
92  
93   /*
94 + * iosend_default - append a packet to the client's sendq.
95 + */
96 + void *
97 + iosend_default(va_list args)
98 + {
99 +  struct Client *to = va_arg(args, struct Client *);
100 +  int length = va_arg(args, int);
101 +  char *buf = va_arg(args, char *);
102 +
103 +  dbuf_put(&to->localClient->buf_sendq, buf, length);
104 +  return NULL;
105 + }
106 +
107 + /*
108   ** send_message
109   **      Internal utility which appends given buffer to the sockets
110   **      sendq.
# Line 98 | Line 112 | send_format(char *lsendbuf, int bufsize,
112   static void
113   send_message(struct Client *to, char *buf, int len)
114   {
115 < #ifdef INVARIANTS
116 <  if (IsMe(to))
103 <  {
104 <    sendto_realops_flags(UMODE_ALL, L_ALL,
105 <                         "Trying to send message to myself!");
106 <    return;
107 <  }
108 < #endif
115 >  assert(!IsMe(to))
116 >  assert(to != &me);
117  
118    if (dbuf_length(&to->localClient->buf_sendq) + len > get_sendq(to))
119    {
# Line 121 | Line 129 | send_message(struct Client *to, char *bu
129      return;
130    }
131  
132 <  dbuf_put(&to->localClient->buf_sendq, buf, len);
132 >  execute_callback(iosend_cb, to, len, buf);
133  
134    /*
135     ** Update statistics. The following is slightly incorrect
# Line 281 | Line 289 | send_queued_write(struct Client *to)
289                errno = EWOULDBLOCK;
290              case SSL_ERROR_SYSCALL:
291                break;
292 <
292 >            case SSL_ERROR_SSL:
293 >              if (errno == EAGAIN)
294 >                break;
295              default:
296                retlen = errno = 0;  /* either an SSL-specific error or EOF */
297            }
# Line 298 | Line 308 | send_queued_write(struct Client *to)
308          break;
309        }
310  
301      execute_callback(iosend_cb, to, retlen, first->data);
311        dbuf_delete(&to->localClient->buf_sendq, retlen);
312  
313        /* We have some data written .. update counters */
# Line 460 | Line 469 | sendto_channel_butone(struct Client *one
469                        struct Channel *chptr, const char *command,
470                        const char *pattern, ...)
471   {
472 <  va_list args;
472 >  va_list alocal, aremote, auid;
473    char local_buf[IRCD_BUFSIZE];
474    char remote_buf[IRCD_BUFSIZE];
475    char uid_buf[IRCD_BUFSIZE];
# Line 481 | Line 490 | sendto_channel_butone(struct Client *one
490    uid_len = ircsprintf(uid_buf, ":%s %s %s ",
491                         ID(from), command, chptr->chname);
492  
493 <  va_start(args, pattern);
493 >  va_start(alocal, pattern);
494 >  va_start(aremote, pattern);
495 >  va_start(auid, pattern);
496    local_len += send_format(&local_buf[local_len], IRCD_BUFSIZE - local_len,
497 <                           pattern, args);
497 >                           pattern, alocal);
498    remote_len += send_format(&remote_buf[remote_len], IRCD_BUFSIZE - remote_len,
499 <                            pattern, args);
499 >                            pattern, aremote);
500    uid_len += send_format(&uid_buf[uid_len], IRCD_BUFSIZE - uid_len, pattern,
501 <                         args);
502 <  va_end(args);
501 >                         auid);
502 >  va_end(auid);
503 >  va_end(aremote);
504 >  va_end(alocal);
505  
506    ++current_serial;
507  
# Line 785 | Line 798 | sendto_channel_remote(struct Client *one
798    len = send_format(buffer, IRCD_BUFSIZE, pattern, args);
799    va_end(args);
800  
801 +  ++current_serial;
802 +
803    DLINK_FOREACH(ptr, chptr->members.head)
804    {
805      ms = ptr->data;
# Line 801 | Line 816 | sendto_channel_remote(struct Client *one
816          ((target_p->from->localClient->caps & caps) != caps) ||
817          ((target_p->from->localClient->caps & nocaps) != 0))
818        continue;
819 <
820 <    send_message(target_p, buffer, len);
819 >    if (target_p->from->serial != current_serial)
820 >    {
821 >      send_message(target_p, buffer, len);
822 >      target_p->from->serial = current_serial;
823 >    }
824    }
825   }
826  
# Line 843 | Line 861 | void
861   sendto_match_butone(struct Client *one, struct Client *from, char *mask,
862                      int what, const char *pattern, ...)
863   {
864 <  va_list args;
864 >  va_list alocal, aremote;
865    struct Client *client_p;
866    dlink_node *ptr, *ptr_next;
867    char local_buf[IRCD_BUFSIZE], remote_buf[IRCD_BUFSIZE];
# Line 851 | Line 869 | sendto_match_butone(struct Client *one,
869                               from->username, from->host);
870    int remote_len = ircsprintf(remote_buf, ":%s ", from->name);
871  
872 <  va_start(args, pattern);
872 >  va_start(alocal, pattern);
873 >  va_start(aremote, pattern);
874    local_len += send_format(&local_buf[local_len], IRCD_BUFSIZE - local_len,
875 <                           pattern, args);
875 >                           pattern, alocal);
876    remote_len += send_format(&remote_buf[remote_len], IRCD_BUFSIZE - remote_len,
877 <                            pattern, args);
878 <  va_end(args);
877 >                            pattern, aremote);
878 >  va_end(aremote);
879 >  va_end(alocal);
880  
881    /* scan the local clients */
882    DLINK_FOREACH(ptr, local_client_list.head)
# Line 1170 | Line 1190 | kill_client_ll_serv_butone(struct Client
1190    char buf_uid[IRCD_BUFSIZE], buf_nick[IRCD_BUFSIZE];
1191    int len_uid = 0, len_nick;
1192  
1173  va_start(args, pattern);
1193    if (HasID(source_p) && (me.id[0] != '\0'))
1194    {
1195      have_uid = 1;
1196 +    va_start(args, pattern);
1197      len_uid = ircsprintf(buf_uid, ":%s KILL %s :", me.id, ID(source_p));
1198      len_uid += send_format(&buf_uid[len_uid], IRCD_BUFSIZE - len_uid, pattern,
1199                             args);
1200 +    va_end(args);
1201    }
1202 +
1203 +  va_start(args, pattern);
1204    len_nick = ircsprintf(buf_nick, ":%s KILL %s :", me.name, source_p->name);
1205    len_nick += send_format(&buf_nick[len_nick], IRCD_BUFSIZE - len_nick, pattern,
1206                            args);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)