summaryrefslogtreecommitdiffstats
path: root/src/net/tcp.c
diff options
context:
space:
mode:
authorMichael Brown2006-04-30 18:59:45 +0200
committerMichael Brown2006-04-30 18:59:45 +0200
commit9e1becaf8a2bd12b5f75ee77b6bb138992bb1a6c (patch)
tree0e4a50f1b14abc877b9d24736eff4d77b43a8d05 /src/net/tcp.c
parentHalf-way tidy (diff)
downloadipxe-9e1becaf8a2bd12b5f75ee77b6bb138992bb1a6c.tar.gz
ipxe-9e1becaf8a2bd12b5f75ee77b6bb138992bb1a6c.tar.xz
ipxe-9e1becaf8a2bd12b5f75ee77b6bb138992bb1a6c.zip
Merge TCP aborted(), timedout() and closed() methods into a single
closed() method with a reason code.
Diffstat (limited to 'src/net/tcp.c')
-rw-r--r--src/net/tcp.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/net/tcp.c b/src/net/tcp.c
index 572e5a4f..ea26f019 100644
--- a/src/net/tcp.c
+++ b/src/net/tcp.c
@@ -2,6 +2,7 @@
#include <assert.h>
#include <byteswap.h>
#include <latch.h>
+#include <errno.h>
#include <gpxe/process.h>
#include <gpxe/init.h>
#include <gpxe/netdevice.h>
@@ -131,18 +132,14 @@ void uip_tcp_appcall ( void ) {
struct tcp_connection *conn = *( ( void ** ) uip_conn->appstate );
struct tcp_operations *op = conn->tcp_op;
- assert ( conn->tcp_op->closed != NULL );
- assert ( conn->tcp_op->connected != NULL );
- assert ( conn->tcp_op->acked != NULL );
- assert ( conn->tcp_op->newdata != NULL );
- assert ( conn->tcp_op->senddata != NULL );
-
- if ( uip_aborted() && op->aborted )
- op->aborted ( conn );
- if ( uip_timedout() && op->timedout )
- op->timedout ( conn );
- if ( uip_closed() && op->closed )
- op->closed ( conn );
+ if ( op->closed ) {
+ if ( uip_aborted() )
+ op->closed ( conn, -ECONNABORTED );
+ if ( uip_timedout() )
+ op->closed ( conn, -ETIMEDOUT );
+ if ( uip_closed() )
+ op->closed ( conn, 0 );
+ }
if ( uip_connected() && op->connected )
op->connected ( conn );
if ( uip_acked() && op->acked )