summaryrefslogtreecommitdiff
path: root/net_ntrip.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-12-16 17:57:46 -0500
committerEric S. Raymond <esr@thyrsus.com>2010-12-16 17:57:46 -0500
commit4a8ba33a11077c241c60cf888f1c5ddb6bbb5b4b (patch)
tree0a3ee4eb9604930556a29c4f5a46b75daab994f7 /net_ntrip.c
parentfd203176f17c88b334008ce752009213f1c127e3 (diff)
downloadgpsd-4a8ba33a11077c241c60cf888f1c5ddb6bbb5b4b.tar.gz
Refactor to turf all uses of gpsd_report() out of netlib.c
A recent bug report makes it clear that all such uses have to be removed from the client libraries. Otherwise a GUI client might dummp log messages uselessly in the X session error log. This is a start.
Diffstat (limited to 'net_ntrip.c')
-rw-r--r--net_ntrip.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net_ntrip.c b/net_ntrip.c
index 4e411f2f..ac6c53b0 100644
--- a/net_ntrip.c
+++ b/net_ntrip.c
@@ -305,15 +305,16 @@ static int ntrip_stream_probe(const char *caster,
char buf[BUFSIZ];
if ((dsock = netlib_connectsock(AF_UNSPEC, caster, port, "tcp")) == -1) {
- printf("ntrip stream connect error %d\n", dsock);
+ gpsd_report(LOG_ERROR, "ntrip stream connect error %d\n", dsock);
return -1;
- }
+ } else
+ gpsd_report(LOG_SPIN, "ntrip stream connectrd on fd %d\n", dsock);
(void)snprintf(buf, sizeof(buf),
"GET / HTTP/1.1\r\n"
"User-Agent: NTRIP gpsd/%s\r\n"
"Connection: close\r\n" "\r\n", VERSION);
if (write(dsock, buf, strlen(buf)) != (ssize_t) strlen(buf)) {
- printf("ntrip stream write error %d\n", dsock);
+ gpsd_report(LOG_ERROR, "ntrip stream write error %d\n", dsock);
return -1;
}
ret =
@@ -364,8 +365,12 @@ static int ntrip_stream_open(const char *caster, const char *port,
return -1;
}
if ((context->dsock =
- netlib_connectsock(AF_UNSPEC, caster, port, "tcp")) < 0)
+ netlib_connectsock(AF_UNSPEC, caster, port, "tcp")) < 0) {
+ gpsd_report(LOG_ERROR,"netlib_connectsock() returns error %d\n", errno);
return -1;
+ } else
+ gpsd_report(LOG_SPIN, "netlib_connectsock() returns socket on fd %d\n",
+ context->dsock);
(void)snprintf(buf, sizeof(buf),
"GET /%s HTTP/1.1\r\n"