va_end(argsPtr);
int bytes = snprintf(tb,MAXBUF,"%s\r\n",textbuffer);
chop(tb);
- if (sock != -1)
+ if ((sock != -1) && (sock != FD_MAGIC_NUMBER))
{
int MOD_RESULT = 0;
FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes > 512 ? 512 : bytes));
va_end(argsPtr);
int bytes = snprintf(tb,MAXBUF,":%s %s\r\n",ServerName,textbuffer);
chop(tb);
- if (sock != -1)
+ if ((sock != -1) && (sock != FD_MAGIC_NUMBER))
{
int MOD_RESULT = 0;
FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes > 512 ? 512 : bytes));
va_end(argsPtr);
int bytes = snprintf(tb,MAXBUF,":%s!%s@%s %s\r\n",user->nick,user->ident,user->dhost,textbuffer);
chop(tb);
- if (sock != -1)
+ if ((sock != -1) && (sock != FD_MAGIC_NUMBER))
{
int MOD_RESULT = 0;
FOREACH_RESULT(OnRawSocketWrite(sock,tb,bytes > 512 ? 512 : bytes));
{
char* o = (*ulist)[j];
userrec* otheruser = (userrec*)o;
- if (!already_sent[otheruser->fd])
+ if ((otheruser->fd > 0) && (!already_sent[otheruser->fd]))
{
already_sent[otheruser->fd] = 1;
WriteFrom(otheruser->fd,u,"%s",textbuffer);
userrec* otheruser = (userrec*)o;
if (u != otheruser)
{
- if (!already_sent[otheruser->fd])
+ if ((otheruser->fd > 0) && (!already_sent[otheruser->fd]))
{
already_sent[otheruser->fd] = 1;
WriteFrom(otheruser->fd,u,"%s",textbuffer);
if ((curr) && (curr->fd != 0))
{
+#ifdef _POSIX_PRIORITY_SCHEDULING
+ sched_yield();
+#endif
// assemble up to 64 sockets into an fd_set
// to implement a pooling mechanism.
//
}
else result = result2;
log(DEBUG,"Read result: %d",result);
-
if (result)
{
statsRecv += result;
if (0) {};
#ifdef _POSIX_PRIORITY_SCHEDULING
sched_yield();
+ sched_yield();
#endif
}
/* not reached */