[ds6-devel] nc6/src connection.c,1.12,1.13 io_stream.c,1.11,1.12
io_stream.h,1.5,1.6 readwrite.c,1.23,1.24
chris@deepspace6.net
chris@deepspace6.net
Wed Jan 1 11:50:10 2003
- Previous message: [ds6-devel] nc6/src connection.c,1.11,1.12 io_stream.c,1.10,1.11
io_stream.h,1.4,1.5 main.c,1.14,1.15 parser.c,1.24,1.25
parser.h,1.10,1.11 readwrite.c,1.22,1.23
- Next message: [ds6-devel]
nc6/src connection.c,1.13,1.14 io_stream.c,1.12,1.13 io_stream.h,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/nc6/src
Modified Files:
connection.c io_stream.c io_stream.h readwrite.c
Log Message:
Gave each io_stream a C-string name, which is used for logging
Index: connection.c
===================================================================
RCS file: /cvs/nc6/src/connection.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- connection.c 1 Jan 2003 10:05:32 -0000 1.12
+++ connection.c 1 Jan 2003 11:50:08 -0000 1.13
@@ -58,6 +58,10 @@
io_stream_init(&(attrs->local_stream),
&(attrs->local_buffer), &(attrs->remote_buffer));
+ /* set the ios names */
+ ios_set_name(&(attrs->remote_stream), "remote");
+ ios_set_name(&(attrs->local_stream), "local");
+
/* the remote stream has an instant hold timeout by default,
* which means that as soon as the remote read stream closes, the
* entire connection will be torn down */
Index: io_stream.c
===================================================================
RCS file: /cvs/nc6/src/io_stream.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- io_stream.c 1 Jan 2003 10:05:32 -0000 1.11
+++ io_stream.c 1 Jan 2003 11:50:08 -0000 1.12
@@ -55,6 +55,7 @@
ios->hold_time = -1; /* infinite */
timerclear(&(ios->read_closed));
+ ios->name = "ios"; /* unspecified */
ios->rcvd = 0;
ios->sent = 0;
}
Index: io_stream.h
===================================================================
RCS file: /cvs/nc6/src/io_stream.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- io_stream.h 1 Jan 2003 10:05:32 -0000 1.5
+++ io_stream.h 1 Jan 2003 11:50:08 -0000 1.6
@@ -44,6 +44,7 @@
-1 means hold indefinately */
struct timeval read_closed; /* the time that the read was closed */
+ const char* name; /* the name of this io stream (for logging) */
size_t rcvd; /* bytes received */
size_t sent; /* bytes sent */
} io_stream;
@@ -96,5 +97,10 @@
#define ios_bytes_received(IOS) ((IOS)->rcvd)
#define ios_bytes_sent(IOS) ((IOS)->sent)
+
+/* set the name of the io_stream */
+#define ios_name(IOS) ((IOS)->name)
+#define ios_set_name(IOS, S) ((IOS)->name = (S))
+
#endif /* IO_STREAM_H */
Index: readwrite.c
===================================================================
RCS file: /cvs/nc6/src/readwrite.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- readwrite.c 1 Jan 2003 10:05:32 -0000 1.23
+++ readwrite.c 1 Jan 2003 11:50:08 -0000 1.24
@@ -111,11 +111,11 @@
#ifndef NDEBUG
if (very_verbose_mode == TRUE) {
if (tvp1)
- warn("ios1 timer expires in %d.%06d",
- tv1.tv_sec, tv1.tv_usec);
+ warn("%s timer expires in %d.%06d",
+ ios_name(ios1), tv1.tv_sec, tv1.tv_usec);
if (tvp2)
- warn("ios2 timer expires in %d.%06d",
- tv2.tv_sec, tv2.tv_usec);
+ warn("%s timer expires in %d.%06d",
+ ios_name(ios2), tv2.tv_sec, tv2.tv_usec);
}
#endif
@@ -151,13 +151,16 @@
if (rr > 0) {
#ifndef NDEBUG
if (very_verbose_mode == TRUE)
- warn("read %d bytes from ios1", rr);
+ warn("read %d bytes from %s",
+ rr, ios_name(ios1));
#endif
} else if (rr == 0) {
#ifndef NDEBUG
if (very_verbose_mode == TRUE) {
- warn("closing read of ios1");
- warn("closing write of ios2");
+ warn("closing read of %s",
+ ios_name(ios1));
+ warn("closing write of %s",
+ ios_name(ios2));
}
#endif
ios_shutdown(ios1, SHUT_RD);
@@ -165,8 +168,8 @@
} else if (rr < 0 && errno != EAGAIN) {
/* error while reading ios1:
* print an error message and exit. */
- fatal("error reading from ios1: %s",
- strerror(errno));
+ fatal("error reading from %s: %s",
+ ios_name(ios1), strerror(errno));
}
}
@@ -177,13 +180,16 @@
if (rr > 0) {
#ifndef NDEBUG
if (very_verbose_mode == TRUE)
- warn("read %d bytes from ios2", rr);
+ warn("read %d bytes from %s",
+ rr, ios_name(ios2));
#endif
} else if (rr == 0) {
#ifndef NDEBUG
if (very_verbose_mode == TRUE) {
- warn("closing read of ios2");
- warn("closing write of ios2");
+ warn("closing read of %s",
+ ios_name(ios2));
+ warn("closing write of %s",
+ ios_name(ios1));
}
#endif
ios_shutdown(ios2, SHUT_RD);
@@ -191,8 +197,8 @@
} else if (rr < 0 && errno != EAGAIN) {
/* error while reading ios2:
* print an error message and exit. */
- fatal("error reading from ios2: %s",
- strerror(errno));
+ fatal("error reading from %s: %s",
+ ios_name(ios2), strerror(errno));
}
}
@@ -204,21 +210,22 @@
if (rr > 0) {
#ifndef NDEBUG
if (very_verbose_mode == TRUE)
- warn("wrote %d bytes to ios1", rr);
+ warn("wrote %d bytes to %s",
+ rr, ios_name(ios1));
#endif
} else if (rr < 0 && errno != EAGAIN) {
/* error while writing to ios1:
* print an error message and exit. */
if (errno != EPIPE)
- fatal("error writing to fd %d: %s",
- ios1_write_fd, strerror(errno));
[...42 lines suppressed...]
- Previous message: [ds6-devel] nc6/src connection.c,1.11,1.12 io_stream.c,1.10,1.11
io_stream.h,1.4,1.5 main.c,1.14,1.15 parser.c,1.24,1.25
parser.h,1.10,1.11 readwrite.c,1.22,1.23
- Next message: [ds6-devel]
nc6/src connection.c,1.13,1.14 io_stream.c,1.12,1.13 io_stream.h,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the ds6-devel
mailing list