#include "server.h"
#include <target/target.h>
+#include <target/target_request.h>
#include "openocd.h"
#include "tcl_server.h"
#include "telnet_server.h"
c->fd_out = c->fd;
/* This increases performance dramatically for e.g. GDB load which
- * does not have a sliding window protocol. */
- retval = setsockopt(c->fd, /* socket affected */
+ * does not have a sliding window protocol.
+ *
+ * Ignore errors from this fn as it probably just means less performance
+ */
+ setsockopt(c->fd, /* socket affected */
IPPROTO_TCP, /* set option at TCP level */
TCP_NODELAY, /* name of option */
(char *)&flag, /* the cast is historical cruft */
struct service *next = c->next;
if (c->name)
- free(c->name);
+ free((void *)c->name);
if (c->type == CONNECTION_PIPE)
{
poll_ok = true;
}
+ /* This is a simple back-off algorithm where we immediately
+ * re-poll if we did something this time around.
+ *
+ * This greatly improves performance of DCC.
+ */
+ poll_ok = poll_ok || target_got_message();
+
for (service = services; service; service = service->next)
{
/* handle new connections on listeners */
{
if ((FD_ISSET(c->fd, &read_fds)) || c->input_pending)
{
- if ((retval = service->input(c)) != ERROR_OK)
+ retval = service->input(c);
+ if (retval != ERROR_OK)
{
struct connection *next = c->next;
if (service->type == CONNECTION_PIPE)
break;
}
default:
- return ERROR_INVALID_ARGUMENTS;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
}
break;
}
default:
- return ERROR_INVALID_ARGUMENTS;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
}