X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=udebug-remote.c;h=0b797f92432c551cc57386f05bd55822ffaecbea;hb=40acbe34632b8e4e860fe41bb14ab5d7d5c9cfe9;hp=f13f6339eebde2d617fbb9de2ffc47176d44af22;hpb=e84c000c4756ae3d0aa80b2c66ec43cf7fc416c4;p=project%2Flibubox.git diff --git a/udebug-remote.c b/udebug-remote.c index f13f633..0b797f9 100644 --- a/udebug-remote.c +++ b/udebug-remote.c @@ -17,31 +17,6 @@ */ #include "udebug-priv.h" -static struct udebug_client_msg * -send_and_wait(struct udebug *ctx, struct udebug_client_msg *msg, int *rfd) -{ - int type = msg->type; - int fd = -1; - - udebug_send_msg(ctx, msg, NULL, -1); - - do { - if (fd >= 0) - close(fd); - fd = -1; - msg = __udebug_poll(ctx, &fd, true); - } while (msg && msg->type != type); - if (!msg) - return NULL; - - if (rfd) - *rfd = fd; - else if (fd >= 0) - close(fd); - - return msg; -} - static int udebug_remote_get_handle(struct udebug *ctx) { @@ -53,7 +28,7 @@ udebug_remote_get_handle(struct udebug *ctx) if (ctx->poll_handle >= 0 || !udebug_is_connected(ctx)) return 0; - msg = send_and_wait(ctx, &send_msg, NULL); + msg = udebug_send_and_wait(ctx, &send_msg, NULL); if (!msg) return -1; @@ -82,7 +57,7 @@ int udebug_remote_buf_map(struct udebug *ctx, struct udebug_remote_buf *rb, uint if (rb->buf.data || !udebug_is_connected(ctx)) return -1; - msg = send_and_wait(ctx, &send_msg, &fd); + msg = udebug_send_and_wait(ctx, &send_msg, &fd); if (!msg || fd < 0) return -1;