Mercurial > hg
comparison contrib/chg/hgclient.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 | 8e5312f8df30 |
children | 7f6e0a15189b |
comparison
equal
deleted
inserted
replaced
28768:2461f33c9f97 | 28769:222f482930c8 |
---|---|
427 struct sockaddr_un addr; | 427 struct sockaddr_un addr; |
428 addr.sun_family = AF_UNIX; | 428 addr.sun_family = AF_UNIX; |
429 strncpy(addr.sun_path, sockname, sizeof(addr.sun_path)); | 429 strncpy(addr.sun_path, sockname, sizeof(addr.sun_path)); |
430 addr.sun_path[sizeof(addr.sun_path) - 1] = '\0'; | 430 addr.sun_path[sizeof(addr.sun_path) - 1] = '\0'; |
431 | 431 |
432 debugmsg("connect to %s", addr.sun_path); | |
433 int r = connect(fd, (struct sockaddr *)&addr, sizeof(addr)); | 432 int r = connect(fd, (struct sockaddr *)&addr, sizeof(addr)); |
434 if (r < 0) { | 433 if (r < 0) { |
435 close(fd); | 434 close(fd); |
436 if (errno == ENOENT || errno == ECONNREFUSED) | 435 if (errno == ENOENT || errno == ECONNREFUSED) |
437 return NULL; | 436 return NULL; |
438 abortmsg("cannot connect to %s (errno = %d)", | 437 abortmsg("cannot connect to %s (errno = %d)", |
439 addr.sun_path, errno); | 438 addr.sun_path, errno); |
440 } | 439 } |
440 debugmsg("connected to %s", addr.sun_path); | |
441 | 441 |
442 hgclient_t *hgc = mallocx(sizeof(hgclient_t)); | 442 hgclient_t *hgc = mallocx(sizeof(hgclient_t)); |
443 memset(hgc, 0, sizeof(*hgc)); | 443 memset(hgc, 0, sizeof(*hgc)); |
444 hgc->sockfd = fd; | 444 hgc->sockfd = fd; |
445 initcontext(&hgc->ctx); | 445 initcontext(&hgc->ctx); |