@@ -29,7 +29,7 @@ int doCasterTCPPhase(caster_t *self)
2929 ERRRET (-1 , self , "Failed to create socket" );
3030
3131 if (shConnect (& sock , & self -> nameserv ))
32- ERRTO (done , self , "caster failed to connect" );
32+ ERRTO (done , self , "Failed to connect (%d)" , ( int ) SOCKERRNO );
3333
3434 if (self -> testhook )
3535 (* self -> testhook )(self , casterTCPSetup );
@@ -74,10 +74,14 @@ int doCasterTCPPhase(caster_t *self)
7474 shSetTimeout (& sock , self -> timeout * 4.0 );
7575
7676 while (!self -> shutdown ) {
77+ int err ;
7778 blen = casterRecvPMsg (& sock , & msgid , & buf .bytes , sizeof (buf .bytes ), 0 );
79+ err = SOCKERRNO ;
7880 if (blen == 0 )
7981 break ; /* normal end of connection */
80- else if (blen < 0 && SOCKERRNO == SOCK_ETIMEDOUT )
82+ else if (blen < 0 && (err == SOCK_ECONNRESET || err == SOCK_ECONNABORTED ))
83+ ERRTO (done , self , "RecCaster connection closed by peer" );
84+ else if (blen < 0 && err == SOCK_ETIMEDOUT )
8185 ERRTO (done , self , "RecCaster server timeout" );
8286 else if (blen < 0 )
8387 ERRTO (done , self , "Missing ping header" );
0 commit comments