diff options
author | waker <wakeroid@gmail.com> | 2012-10-08 22:22:54 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-10-08 22:22:54 +0200 |
commit | 4224404f39f6e570790d469fb5455fd8f2784014 (patch) | |
tree | 212bff9bb496b0f7874456503100faab146a420f /plugins/mms | |
parent | 961135a83d63b56055e8c2c71d16c175bdf78520 (diff) |
mms: more abortion improvements
Diffstat (limited to 'plugins/mms')
-rw-r--r-- | plugins/mms/libmms/mms.c | 6 | ||||
-rw-r--r-- | plugins/mms/libmms/mmsh.c | 4 | ||||
-rw-r--r-- | plugins/mms/libmms/mmsio.h | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/plugins/mms/libmms/mms.c b/plugins/mms/libmms/mms.c index e8cfae80..15c9cca9 100644 --- a/plugins/mms/libmms/mms.c +++ b/plugins/mms/libmms/mms.c @@ -192,7 +192,7 @@ static off_t fallback_io_write(void *data, int socket, char *buf, off_t num) return (off_t)write(socket, buf, num); } -static int fallback_io_tcp_connect(void *data, const char *host, int port) +static int fallback_io_tcp_connect(void *data, const char *host, int port, int *need_abort) { struct hostent *h; @@ -226,7 +226,7 @@ static int fallback_io_tcp_connect(void *data, const char *host, int port) time_t t = time (NULL); int error = 0; - for (;;) { + while (!need_abort || !(*need_abort)) { int res = connect(s, (struct sockaddr *)&sin, sizeof(sin)); if (res == -1 && (errno == EINPROGRESS || errno == EALREADY)) { if (time (NULL) - t > 3) { @@ -882,7 +882,7 @@ static int mms_tcp_connect(mms_io_t *io, mms_t *this) { * try to connect */ lprintf("mms: trying to connect to %s on port %d\n", this->host, this->port); - this->s = io_connect(io, this->host, this->port); + this->s = io_connect(io, this->host, this->port, this->need_abort); if (this->s == -1) { lprintf("mms: failed to connect to %s\n", this->host); return 1; diff --git a/plugins/mms/libmms/mmsh.c b/plugins/mms/libmms/mmsh.c index fe3d12ce..0606ac53 100644 --- a/plugins/mms/libmms/mmsh.c +++ b/plugins/mms/libmms/mmsh.c @@ -248,7 +248,7 @@ static off_t fallback_io_write(void *data, int socket, char *buf, off_t num) return (off_t)write(socket, buf, num); } -static int fallback_io_tcp_connect(void *data, const char *host, int port) +static int fallback_io_tcp_connect(void *data, const char *host, int port, int *need_abort) { struct hostent *h; @@ -822,7 +822,7 @@ static int mmsh_tcp_connect(mms_io_t *io, mmsh_t *this) { */ lprintf("mmsh: try to connect to %s on port %d \n", this->connect_host, this->connect_port); - this->s = io_connect (io, this->connect_host, this->connect_port); + this->s = io_connect (io, this->connect_host, this->connect_port, this->need_abort); if (this->s == -1) { lprintf("mmsh: failed to connect '%s'\n", this->connect_host); diff --git a/plugins/mms/libmms/mmsio.h b/plugins/mms/libmms/mmsio.h index a1cb93bb..376e6736 100644 --- a/plugins/mms/libmms/mmsio.h +++ b/plugins/mms/libmms/mmsio.h @@ -66,7 +66,7 @@ typedef int (*mms_io_select_func)(void *data, int fd, int state, int timeout_mse * * returns a socket descriptor or -1 if an error occured */ -typedef int (*mms_io_tcp_connect_func)(void *data, const char *host, int port); +typedef int (*mms_io_tcp_connect_func)(void *data, const char *host, int port, int *need_abort); typedef struct { |