#include "ircd.h"
#include "ircd_defs.h"
#include "numeric.h"
-#include "commio.h"
#include "s_conf.h"
#include "s_newconf.h"
#include "s_stats.h"
#include "send.h"
-#include "memory.h"
#include "s_auth.h"
#include "reject.h"
#include "s_conf.h"
static listener_t *
make_listener(struct irc_sockaddr_storage *addr)
{
- listener_t *listener = (listener_t *) MyMalloc(sizeof(listener_t));
+ listener_t *listener = (listener_t *) rb_malloc(sizeof(listener_t));
s_assert(0 != listener);
listener->name = me.name;
}
/* free */
- MyFree(listener);
+ rb_free(listener);
}
#define PORTNAMELEN 6 /* ":31337" */
#endif
port = ntohs(((const struct sockaddr_in *)&listener->addr)->sin_port);
- ircsnprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port);
+ rb_snprintf(buf, sizeof(buf), "%s[%s/%u]", me.name, listener->name, port);
return buf;
}
* At first, open a new socket
*/
- fd = comm_socket(listener->addr.ss_family, SOCK_STREAM, 0, "Listener socket");
+ fd = rb_socket(listener->addr.ss_family, SOCK_STREAM, 0, "Listener socket");
#ifdef IPV6
if(listener->addr.ss_family == AF_INET6)
report_error("setting SO_REUSEADDR for listener %s:%s",
get_listener_name(listener),
get_listener_name(listener), errno);
- comm_close(fd);
+ rb_close(fd);
return 0;
}
report_error("binding listener socket %s:%s",
get_listener_name(listener),
get_listener_name(listener), errno);
- comm_close(fd);
+ rb_close(fd);
return 0;
}
report_error("listen failed for %s:%s",
get_listener_name(listener),
get_listener_name(listener), errno);
- comm_close(fd);
+ rb_close(fd);
return 0;
}
return;
if(listener->fd >= 0)
{
- comm_close(listener->fd);
+ rb_close(listener->fd);
listener->fd = -1;
}
strlcpy(new_client->host, new_client->sockhost, sizeof(new_client->host));
- new_client->localClient->fd = fd;
+ new_client->localClient->F = rb_add_fd(fd);
new_client->localClient->listener = listener;
++listener->ref_count;
* be accepted until some old is closed first.
*/
- fd = comm_accept(listener->fd, (struct sockaddr *)&sai, &addrlen);
+ fd = rb_accept(listener->fd, (struct sockaddr *)&sai, &addrlen);
if(fd < 0)
{
/* Re-register a new IO request for the next accept .. */
- comm_setselect(listener->fd, FDLIST_SERVICE,
+ rb_setselect(listener->fd, FDLIST_SERVICE,
COMM_SELECT_READ, accept_connection, listener, 0);
return;
}
* check for connection limit
* TBD: this is stupid... either we have a socket or we don't. -nenolod
*/
- if((comm_get_maxconnections() - 10) < fd)
+ if((rb_get_maxconnections() - 10) < fd)
{
++ServerStats->is_ref;
/*
}
write(fd, "ERROR :All connections in use\r\n", 32);
- comm_close(fd);
+ rb_close(fd);
/* Re-register a new IO request for the next accept .. */
- comm_setselect(listener->fd, FDLIST_SERVICE,
+ rb_setselect(listener->fd, FDLIST_SERVICE,
COMM_SELECT_READ, accept_connection, listener, 0);
return;
}
if(ConfigFileEntry.dline_with_reason)
{
- if (ircsnprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (sizeof(buf)-1))
+ if (rb_snprintf(buf, sizeof(buf), "ERROR :*** Banned: %s\r\n", aconf->passwd) >= (sizeof(buf)-1))
{
buf[sizeof(buf) - 3] = '\r';
buf[sizeof(buf) - 2] = '\n';
}
}
else
- ircsprintf(buf, "ERROR :You have been D-lined.\r\n");
+ rb_sprintf(buf, "ERROR :You have been D-lined.\r\n");
write(fd, buf, strlen(buf));
- comm_close(fd);
+ rb_close(fd);
/* Re-register a new IO request for the next accept .. */
- comm_setselect(listener->fd, FDLIST_SERVICE,
+ rb_setselect(listener->fd, FDLIST_SERVICE,
COMM_SELECT_READ, accept_connection, listener, 0);
return;
}
add_connection(listener, fd, (struct sockaddr *)&sai, aconf ? 1 : 0);
/* Re-register a new IO request for the next accept .. */
- comm_setselect(listener->fd, FDLIST_SERVICE, COMM_SELECT_READ,
+ rb_setselect(listener->fd, FDLIST_SERVICE, COMM_SELECT_READ,
accept_connection, listener, 0);
}