Remove redundant sock member in session. io already holds the sock for each session.
authorSunil Nimmagadda <sunil@nimmagadda.net>
Fri, 11 Apr 2014 10:01:48 +0500
changeset 17 596dec2978b2
parent 16 d8eab19b329e
child 18 1d773aa5e87e
Remove redundant sock member in session. io already holds the sock for each session.
pop3d.h
session.c
--- a/pop3d.h	Thu Apr 10 18:26:13 2014 +0500
+++ b/pop3d.h	Fri Apr 11 10:01:48 2014 +0500
@@ -138,7 +138,6 @@
 	size_t			nmsgs;
 	struct listener		*l;
 	uint32_t		id;
-	int			sock;
 	int			flags;
 	enum state		state;
 };
--- a/session.c	Thu Apr 10 18:26:13 2014 +0500
+++ b/session.c	Fri Apr 11 10:01:48 2014 +0500
@@ -110,11 +110,10 @@
 	io_init(&s->io, fd, s, session_io, &s->iobuf);
 	io_set_timeout(&s->io, TIMEOUT);
 	s->id = arc4random();
-	s->sock = fd;
 	s->state = AUTH;
 	if (s->l->flags & POP3S) {
 		s->flags |= POP3S;
-		ssl = pop3s_init(ssl_ctx, s->sock);
+		ssl = pop3s_init(ssl_ctx, fd);
 		io_set_read(&s->io);
 		io_start_tls(&s->io, ssl);
 		return;
@@ -283,7 +282,7 @@
 		iobuf_flush(&s->iobuf, s->io.sock);
 		/* add back when IO_TLSREADY. */
 		SPLAY_REMOVE(session_tree, &sessions, s);
-		ssl = pop3s_init(ssl_ctx, s->sock);
+		ssl = pop3s_init(ssl_ctx, s->io.sock);
 		io_set_read(&s->io);
 		io_start_tls(&s->io, ssl);
 		return;