@@ -121,8 +121,8 @@ tarantool_stream_send(tarantool_object *obj TSRMLS_DC) {
121121 * See https://bugs.launchpad.net/tarantool/+bug/1182474
122122 */
123123static size_t
124- tarantool_stream_read (tarantool_object * obj , char * buf , size_t size ) {
125- return tntll_stream_read (obj -> stream , buf , size );
124+ tarantool_stream_read (tarantool_connection * obj , char * buf , size_t size ) {
125+ return tntll_stream_read2 (obj -> stream , buf , size );
126126}
127127
128128static void
@@ -172,8 +172,8 @@ int __tarantool_connect(tarantool_object *obj, zval *id TSRMLS_DC) {
172172 & obj -> stream , & err ) == -1 ) {
173173 continue ;
174174 }
175- if (tntll_stream_read (obj -> stream , obj -> greeting ,
176- GREETING_SIZE ) == -1 ) {
175+ if (tntll_stream_read2 (obj -> stream , obj -> greeting ,
176+ GREETING_SIZE ) == -1 ) {
177177 continue ;
178178 }
179179 obj -> salt = obj -> greeting + SALT_PREFIX_SIZE ;
@@ -257,7 +257,7 @@ static int64_t tarantool_step_recv(
257257 * header = NULL ;
258258 * body = NULL ;
259259 if (tarantool_stream_read (obj , pack_len , 5 ) != 5 ) {
260- THROW_EXC ("Can't read query from server" );
260+ THROW_EXC ("Can't read query from server (failed to read length) " );
261261 goto error_con ;
262262 }
263263 if (php_mp_check (pack_len , 5 )) {
@@ -268,14 +268,15 @@ static int64_t tarantool_step_recv(
268268 smart_string_ensure (obj -> value , body_size );
269269 if (tarantool_stream_read (obj , SSTR_POS (obj -> value ),
270270 body_size ) != body_size ) {
271- THROW_EXC ("Can't read query from server" );
271+ THROW_EXC ("Can't read query from server (failed to read %d "
272+ "bytes from server [header + body])" , body_size );
272273 goto error ;
273274 }
274275 SSTR_LEN (obj -> value ) += body_size ;
275276
276277 char * pos = SSTR_BEG (obj -> value );
277278 if (php_mp_check (pos , body_size )) {
278- THROW_EXC ("Failed verifying msgpack" );
279+ THROW_EXC ("Failed verifying header [bad msgpack] " );
279280 goto error ;
280281 }
281282 if (php_mp_unpack (header , & pos ) == FAILURE ||
@@ -284,7 +285,7 @@ static int64_t tarantool_step_recv(
284285 goto error ;
285286 }
286287 if (php_mp_check (pos , body_size )) {
287- THROW_EXC ("Failed verifying msgpack" );
288+ THROW_EXC ("Failed verifying body [bad msgpack] " );
288289 goto error_con ;
289290 }
290291 if (php_mp_unpack (body , & pos ) == FAILURE ) {
@@ -591,14 +592,15 @@ int get_spaceno_by_name(tarantool_object *obj, zval *id, zval *name TSRMLS_DC) {
591592
592593 char pack_len [5 ] = {0 , 0 , 0 , 0 , 0 };
593594 if (tarantool_stream_read (obj , pack_len , 5 ) != 5 ) {
594- THROW_EXC ("Can't read query from server" );
595+ THROW_EXC ("Can't read query from server (failed to read length) " );
595596 return FAILURE ;
596597 }
597598 size_t body_size = php_mp_unpack_package_size (pack_len );
598599 smart_string_ensure (obj -> value , body_size );
599600 if (tarantool_stream_read (obj , obj -> value -> c ,
600601 body_size ) != body_size ) {
601- THROW_EXC ("Can't read query from server" );
602+ THROW_EXC ("Can't read query from server (failed to read %d "
603+ "bytes from server [header + body])" , body_size );
602604 return FAILURE ;
603605 }
604606
@@ -651,14 +653,15 @@ int get_indexno_by_name(tarantool_object *obj, zval *id,
651653
652654 char pack_len [5 ] = {0 , 0 , 0 , 0 , 0 };
653655 if (tarantool_stream_read (obj , pack_len , 5 ) != 5 ) {
654- THROW_EXC ("Can't read query from server" );
656+ THROW_EXC ("Can't read query from server (failed to read length) " );
655657 return FAILURE ;
656658 }
657659 size_t body_size = php_mp_unpack_package_size (pack_len );
658660 smart_string_ensure (obj -> value , body_size );
659661 if (tarantool_stream_read (obj , obj -> value -> c ,
660662 body_size ) != body_size ) {
661- THROW_EXC ("Can't read query from server" );
663+ THROW_EXC ("Can't read query from server (failed to read %d "
664+ "bytes from server [header + body])" , body_size );
662665 return FAILURE ;
663666 }
664667
0 commit comments