Browse code

tcp: more complete error messages

- more information in some error messages (very useful when
debugging)
- spelling fixes

Andrei Pelinescu-Onciul authored on 06/07/2010 21:34:17
Showing 2 changed files
... ...
@@ -205,8 +205,8 @@ again:
205 205
 	if (ret<0){
206 206
 		if (errno==EINTR) goto again;
207 207
 		if ((errno!=EAGAIN) && (errno!=EWOULDBLOCK))
208
-			LOG(L_CRIT, "ERROR: send_fd: sendmsg failed on %d: %s\n",
209
-					unix_socket, strerror(errno));
208
+			LOG(L_CRIT, "ERROR: send_fd: sendmsg failed sending %d on %d:"
209
+						" %s (%d)\n", fd, unix_socket, strerror(errno), errno);
210 210
 	}
211 211
 	
212 212
 	return ret;
... ...
@@ -3542,12 +3542,13 @@ inline static int handle_ser_child(struct process_table* p, int fd_i)
3542 3542
 	switch(cmd){
3543 3543
 		case CONN_ERROR:
3544 3544
 			LOG(L_ERR, "handle_ser_child: ERROR: received CON_ERROR for %p"
3545
-					" (id %d), refcnt %d\n", 
3546
-					tcpconn, tcpconn->id, atomic_get(&tcpconn->refcnt));
3545
+					" (id %d), refcnt %d, flags 0x%0x\n",
3546
+					tcpconn, tcpconn->id, atomic_get(&tcpconn->refcnt),
3547
+					tcpconn->flags);
3547 3548
 		case CONN_EOF: /* forced EOF after full send, due to send flags */
3548 3549
 #ifdef TCP_CONNECT_WAIT
3549 3550
 			/* if the connection is pending => it might be on the way of
3550
-			 * reaching tcp_main (e.g. CONN_NEW_COMPLETE or 
3551
+			 * reaching tcp_main (e.g. CONN_NEW_COMPLETE or
3551 3552
 			 *  CONN_NEW_PENDING_WRITE) =>  it cannot be destroyed here */
3552 3553
 			if ( !(tcpconn->flags & F_CONN_PENDING) &&
3553 3554
 					tcpconn_try_unhash(tcpconn) )
... ...
@@ -3855,14 +3856,16 @@ inline static int send2child(struct tcp_connection* tcpconn)
3855 3855
 				return -1;
3856 3856
 			}
3857 3857
 		}else{
3858
-			LOG(L_ERR, "ERROR: send2child: send_fd failed\n");
3858
+			LOG(L_ERR, "ERROR: send2child: send_fd failed for %p (flags 0x%0x)"
3859
+						", fd %d\n", tcpconn, tcpconn->flags, tcpconn->s);
3859 3860
 			return -1;
3860 3861
 		}
3861 3862
 	}
3862 3863
 #else
3863 3864
 	if (unlikely(send_fd(tcp_children[idx].unix_sock, &tcpconn,
3864 3865
 						sizeof(tcpconn), tcpconn->s)<=0)){
3865
-		LOG(L_ERR, "ERROR: send2child: send_fd failed\n");
3866
+		LOG(L_ERR, "ERROR: send2child: send_fd failed for %p (flags 0x%0x)"
3867
+					", fd %d\n", tcpconn, tcpconn->flags, tcpconn->s);
3866 3868
 		return -1;
3867 3869
 	}
3868 3870
 #endif
... ...
@@ -3987,7 +3990,7 @@ static inline int handle_new_connect(struct socket_info* si)
3987 3987
  *            tcp_main is not interested in further io events that might be
3988 3988
  *            queued for this fd)
3989 3989
  */
3990
-inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, short ev, 
3990
+inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, short ev,
3991 3991
 										int fd_i)
3992 3992
 {
3993 3993
 #ifdef TCP_ASYNC
... ...
@@ -4204,7 +4207,7 @@ inline static int handle_io(struct fd_map* fm, short ev, int idx)
4204 4204
 						" idx %d\n", fm, fm->fd, fm->type, fm->data, idx);
4205 4205
 			goto error;
4206 4206
 		default:
4207
-			LOG(L_CRIT, "BUG: handle_io: uknown fd type %d\n", fm->type); 
4207
+			LOG(L_CRIT, "BUG: handle_io: unknown fd type %d\n", fm->type); 
4208 4208
 			goto error;
4209 4209
 	}
4210 4210
 	return ret;