Permalink
Browse files

MB-3845 - Improved rehabilitation of a born-again conn

It's possible that a conn_new() reuses a conn structure from the
freelist rather than from calloc().  Initialize the fields of that
recycled conn better.

Change-Id: Ib0f491106980f4648c0c60a1ab3c9c5af61a4486
Reviewed-on: http://review.membase.org/6265
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
  • Loading branch information...
steveyen authored and alk committed May 16, 2011
1 parent 5fa3a33 commit 1222513cf9b9d7efb103351372659de33bf982ac
Showing with 5 additions and 0 deletions.
  1. +5 −0 memcached.c
View
@@ -440,11 +440,16 @@ conn *conn_new(const int sfd, enum conn_states init_state,
moxi_log_write( "<%d initialized conn_funcs to default\n", sfd);
}
+ c->cmd_curr = -1;
c->cmd_start = NULL;
c->cmd_start_time = 0;
c->cmd_retries = 0;
c->corked = NULL;
c->host_ident = NULL;
+ c->peer_host = NULL;
+ c->peer_protocol = 0;
+ c->peer_port = 0;
+ c->update_diag = NULL;
c->extra = extra;

0 comments on commit 1222513

Please sign in to comment.