@@ -1179,19 +1179,29 @@ ssize_t timed_read_from_rtsp_connection(rtsp_conn_info *conn, uint64_t wait_time
1179
1179
read_encrypted (conn -> fd , & conn -> ap2_pairing_context .control_cipher_bundle , buf , count );
1180
1180
} else {
1181
1181
result = read (conn -> fd , buf , count );
1182
- if (result == 0 )
1183
- debug (1 , "AP2 read result 0, for a request count of %u." , count );
1182
+ if (result == 0 ) {
1183
+ debug (1 , "AP2 read result 0, for a request count of %u." , count );
1184
+ }
1184
1185
}
1185
1186
#else
1186
1187
result = read (conn -> fd , buf , count );
1187
- if (result == 0 )
1188
+ if (result == 0 ) {
1188
1189
debug (1 , "AP1 read result 0, for a request count of %u." , count );
1190
+
1191
+ }
1189
1192
#endif
1193
+ if ((result == 0 ) && (errno != 0 )) {
1194
+ char errorstring [1024 ];
1195
+ strerror_r (errno , (char * )errorstring , sizeof (errorstring ));
1196
+ debug (1 , "Connection %d: read result 0, error %d: \"%s\"." ,
1197
+ conn -> connection_number , errno , (char * )errorstring );
1198
+ }
1199
+
1190
1200
if (wait_time != 0 )
1191
1201
remaining_time = time_to_wait_to - get_absolute_time_in_ns ();
1192
- if (((result == -1 ) && ((errno == EAGAIN ) || (errno == EWOULDBLOCK ))) && (remaining_time > 0 ))
1202
+ if (((( result == -1 ) || ( result == 0 ) ) && ((errno == EAGAIN ) || (errno == EWOULDBLOCK ))) && (remaining_time > 0 ))
1193
1203
debug (1 , "remaining time on a timed read is %" PRId64 " ns." , remaining_time );
1194
- } while (((result == -1 ) && ((errno == EAGAIN ) || (errno == EWOULDBLOCK ))) &&
1204
+ } while (((( result == -1 ) || ( result == 0 ) ) && ((errno == EAGAIN ) || (errno == EWOULDBLOCK ))) &&
1195
1205
(remaining_time > 0 ));
1196
1206
1197
1207
} else {
0 commit comments