comparison contrib/chg/chg.c @ 28769:222f482930c8

chg: make connect debug message less repetitive Before this patch, "connect to" debug message is printed repeatedly because a previous patch changed how the chg client decides the server is ready to be connected. This patch revises the places we print connect debug messages so they are less repetitive without losing useful information.
author Jun Wu <quark@fb.com>
date Mon, 04 Apr 2016 02:36:05 +0100
parents baa073200ba2
children ea86cdcd9b50
comparison
equal deleted inserted replaced
28768:2461f33c9f97 28769:222f482930c8
234 static hgclient_t *retryconnectcmdserver(struct cmdserveropts *opts, pid_t pid) 234 static hgclient_t *retryconnectcmdserver(struct cmdserveropts *opts, pid_t pid)
235 { 235 {
236 static const struct timespec sleepreq = {0, 10 * 1000000}; 236 static const struct timespec sleepreq = {0, 10 * 1000000};
237 int pst = 0; 237 int pst = 0;
238 238
239 debugmsg("try connect to %s repeatedly", opts->sockname);
239 for (unsigned int i = 0; i < 10 * 100; i++) { 240 for (unsigned int i = 0; i < 10 * 100; i++) {
240 hgclient_t *hgc = hgc_open(opts->sockname); 241 hgclient_t *hgc = hgc_open(opts->sockname);
241 if (hgc) 242 if (hgc)
242 return hgc; 243 return hgc;
243 244
269 /* Connect to a cmdserver. Will start a new server on demand. */ 270 /* Connect to a cmdserver. Will start a new server on demand. */
270 static hgclient_t *connectcmdserver(struct cmdserveropts *opts) 271 static hgclient_t *connectcmdserver(struct cmdserveropts *opts)
271 { 272 {
272 const char *sockname = opts->redirectsockname[0] ? 273 const char *sockname = opts->redirectsockname[0] ?
273 opts->redirectsockname : opts->sockname; 274 opts->redirectsockname : opts->sockname;
275 debugmsg("try connect to %s", sockname);
274 hgclient_t *hgc = hgc_open(sockname); 276 hgclient_t *hgc = hgc_open(sockname);
275 if (hgc) 277 if (hgc)
276 return hgc; 278 return hgc;
277 279
278 lockcmdserver(opts); 280 lockcmdserver(opts);