fix undefined value

[skip ci]
This commit is contained in:
Konstantin Käfer
2014-11-06 02:58:14 -08:00
committed by Konstantin Käfer
parent 2e38b5964c
commit 3303db79d9

View File

@@ -245,13 +245,9 @@ void curl_perform(uv_poll_t *req, int /* status */, int events) {
}
int handle_socket(CURL * /* handle */, curl_socket_t s, int action, void * /* userp */, void *socketp) {
Socket *socket;
if (action == CURL_POLL_IN || action == CURL_POLL_OUT) {
if (socketp) {
socket = (Socket *)socketp;
} else {
socket = new Socket(s);
}
Socket *socket = (Socket *)socketp;
if (!socket && action != CURL_POLL_REMOVE) {
socket = new Socket(s);
curl_multi_assign(multi, s, (void *)socket);
}
@@ -263,8 +259,8 @@ int handle_socket(CURL * /* handle */, curl_socket_t s, int action, void * /* us
socket->start(UV_WRITABLE, curl_perform);
break;
case CURL_POLL_REMOVE:
if (socketp) {
((Socket *)socketp)->stop();
if (socket) {
socket->stop();
curl_multi_assign(multi, s, NULL);
}
break;