[JDEV] Finding the client port from an MIO socket
Robert Norris
rob at nauseum.org
Tue Jun 12 19:00:56 CDT 2001
> MIO doesn't keep track of the remote port, but it does keep the remote IP in the m->ip member..
I've made a small patch to jabberd that gets MIO to keep track of the port.
If you accept it, it will be useful with the PASS component I wrote, if
nothing else.
Regards,
Rob.
-------------- next part --------------
diff -r -U3 jabberd.old/jabberd.h jabberd/jabberd.h
--- jabberd.old/jabberd.h Wed Jun 13 09:56:34 2001
+++ jabberd/jabberd.h Wed Jun 13 09:56:24 2001
@@ -218,6 +218,7 @@
int rated; /* is this socket rate limted? */
jlimit rate; /* if so, what is the rate? */
char *ip;
+ int port;
} *mio, _mio;
/* MIO SOCKET HANDLERS */
diff -r -U3 jabberd.old/mio.c jabberd/mio.c
--- jabberd.old/mio.c Wed Jun 13 09:56:34 2001
+++ jabberd/mio.c Wed Jun 13 09:56:24 2001
@@ -397,6 +397,7 @@
/* create a new sock object for this connection */
new = mio_new(fd, m->cb, m->cb_arg, mio_handlers_new(m->mh->read, m->mh->write, m->mh->parser));
new->ip = pstrdup(new->p, inet_ntoa(serv_addr.sin_addr));
+ new->port = ntohs(serv_addr.sin_port);
#ifdef HAVE_SSL
new->ssl = m->ssl;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <https://www.jabber.org/jdev/attachments/20010613/476998e5/attachment-0002.pgp>
More information about the JDev
mailing list