Fix error checking after stomp_send().

This one has been in there for a while and would hang for me in
1.0.6 release if the connection was refused.

Some tests would fail too. This error was also somewhat masked in
previous release. We should abort and throw an exception if send
fails.
master
Gennady Feldman 2015-05-05 10:17:49 -04:00
parent 8b0bbd4db2
commit fbacdccd37
1 changed files with 8 additions and 1 deletions

View File

@ -549,8 +549,15 @@ PHP_FUNCTION(stomp_connect)
FRAME_HEADER_FROM_HASHTABLE(frame.headers, Z_ARRVAL_P(headers));
}
stomp_send(stomp, &frame TSRMLS_CC);
res = stomp_send(stomp, &frame TSRMLS_CC);
CLEAR_FRAME(frame);
if (0 == res) {
zval *excobj = zend_throw_exception_ex(stomp_ce_exception, stomp->errnum TSRMLS_CC, stomp->error);
if (stomp->error_details) {
zend_update_property_string(stomp_ce_exception, excobj, "details", sizeof("details")-1, stomp->error_details TSRMLS_CC);
}
return;
}
/* Retreive Response */
res = stomp_read_frame(stomp);