Browse Source

Tidy up debug messages

tags/v0.9.3
Michael Brown 18 years ago
parent
commit
138967dd6b
1 changed files with 24 additions and 9 deletions
  1. 24
    9
      src/net/stream.c

+ 24
- 9
src/net/stream.c View File

45
 	app->conn = conn;
45
 	app->conn = conn;
46
 }
46
 }
47
 
47
 
48
+/**
49
+ * Disassociate application from connection
50
+ *
51
+ * @v app		Stream application
52
+ * @v conn		Stream connection
53
+ */
54
+static void stream_disassociate ( struct stream_application *app,
55
+				  struct stream_connection *conn ) {
56
+
57
+	DBGC ( app, "Stream %p disassociating from connection %p\n",
58
+	       app, conn );
59
+
60
+	assert ( conn->app == app );
61
+	assert ( app->conn == conn );
62
+	conn->app = NULL;
63
+	app->conn = NULL;	
64
+}
65
+
48
 /**
66
 /**
49
  * Connection established
67
  * Connection established
50
  *
68
  *
76
 void stream_closed ( struct stream_connection *conn, int rc ) {
94
 void stream_closed ( struct stream_connection *conn, int rc ) {
77
 	struct stream_application *app = conn->app;
95
 	struct stream_application *app = conn->app;
78
 
96
 
79
-	DBGC ( app, "Stream %p closed (%s)\n", app, strerror ( rc ) );
80
-
81
 	/* Check connection actually exists */
97
 	/* Check connection actually exists */
82
 	if ( ! app ) {
98
 	if ( ! app ) {
83
-		DBGC ( conn, "Stream connection %p has no application\n",
84
-		       conn );
99
+		/* Not an error; don't display a debug message */
85
 		return;
100
 		return;
86
 	}
101
 	}
87
 
102
 
103
+	DBGC ( app, "Stream %p closed (%s)\n", app, strerror ( rc ) );
104
+
88
 	/* Disassociate application from connection */
105
 	/* Disassociate application from connection */
89
-	app->conn = NULL;
90
-	conn->app = NULL;
106
+	stream_disassociate ( app, conn );
91
 
107
 
92
 	/* Hand off to application */
108
 	/* Hand off to application */
93
 	if ( app->op->closed )
109
 	if ( app->op->closed )
244
 
260
 
245
 	/* Check connection actually exists */
261
 	/* Check connection actually exists */
246
 	if ( ! conn ) {
262
 	if ( ! conn ) {
247
-		DBGC ( app, "Stream %p has no connection\n", app );
263
+		/* Not an error; don't display a debug message */
248
 		return;
264
 		return;
249
 	}
265
 	}
250
 
266
 
251
 	/* Disassociate application from connection */
267
 	/* Disassociate application from connection */
252
-	app->conn = NULL;
253
-	conn->app = NULL;
268
+	stream_disassociate ( app, conn );
254
 
269
 
255
 	/* Hand off to connection */
270
 	/* Hand off to connection */
256
 	if ( ! conn->op->close )
271
 	if ( ! conn->op->close )

Loading…
Cancel
Save