about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2002-11-20 15:48:41 +0000
committerAlexander Barton <alex@barton.de>2002-11-20 15:48:41 +0000
commitc6b9f3a13d4676dafbdbbc3ed1d200b486c537c8 (patch)
tree85191292dcff96e1c75deb6639f99d58f8a365b7
parent6d5b606c46d07a851ec4012814f2778462235cca (diff)
downloadngircd-c6b9f3a13d4676dafbdbbc3ed1d200b486c537c8.tar.gz
ngircd-c6b9f3a13d4676dafbdbbc3ed1d200b486c537c8.zip
- angenommene Socketes werden nun korrekt auf "non-blocking" gestellt;
- beim Senden und Empfangen wird EAGAIN ("Blockierung") nun abgefangen.
-rw-r--r--src/ngircd/conn.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index bef5b149..70ce5d1b 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -9,7 +9,7 @@
  * Naehere Informationen entnehmen Sie bitter der Datei COPYING. Eine Liste
  * der an ngIRCd beteiligten Autoren finden Sie in der Datei AUTHORS.
  *
- * $Id: conn.c,v 1.90 2002/11/19 12:50:20 alex Exp $
+ * $Id: conn.c,v 1.91 2002/11/20 15:48:41 alex Exp $
  *
  * connect.h: Verwaltung aller Netz-Verbindungen ("connections")
  */
@@ -789,6 +789,9 @@ Handle_Write( CONN_ID Idx )
 	len = send( My_Connections[Idx].sock, My_Connections[Idx].wbuf, My_Connections[Idx].wdatalen, 0 );
 	if( len < 0 )
 	{
+		/* Operation haette Socket "nur" blockiert ... */
+		if( errno == EAGAIN ) return TRUE;
+
 		/* Oops, ein Fehler! */
 		Log( LOG_ERR, "Write error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror( errno ));
 		Conn_Close( Idx, "Write error!", NULL, FALSE );
@@ -822,6 +825,7 @@ New_Connection( INT Sock )
 
 	assert( Sock > NONE );
 
+	/* Connection auf Listen-Socket annehmen */
 	new_sock_len = sizeof( new_addr );
 	new_sock = accept( Sock, (struct sockaddr *)&new_addr, (socklen_t *)&new_sock_len );
 	if( new_sock < 0 )
@@ -830,6 +834,9 @@ New_Connection( INT Sock )
 		return;
 	}
 
+	/* Socket initialisieren */
+	Init_Socket( new_sock );
+
 	/* Freie Connection-Struktur suchen */
 	for( idx = 0; idx < Pool_Size; idx++ ) if( My_Connections[idx].sock == NONE ) break;
 	if( idx >= Pool_Size )
@@ -972,6 +979,9 @@ Read_Request( CONN_ID Idx )
 
 	if( len < 0 )
 	{
+		/* Operation haette Socket "nur" blockiert ... */
+		if( errno == EAGAIN ) return;
+
 		/* Fehler beim Lesen */
 		Log( LOG_ERR, "Read error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror( errno ));
 		Conn_Close( Idx, "Read error!", "Client closed connection", FALSE );