#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 */
} else
{
char *end;
- strtol(c->port, &end, 0);
+ portnumber = strtol(c->port, &end, 0);
if (!*end && (parse_long(c->port, &portnumber) == ERROR_OK))
{
c->portnumber = portnumber;
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)
shutdown_openocd = 1;
}
remove_connection(service, c);
- LOG_INFO("dropped '%s' connection - error %d", service->name, retval);
+ LOG_INFO("dropped '%s' connection", service->name);
c = next;
continue;
}
.name = "shutdown",
.handler = &handle_shutdown_command,
.mode = COMMAND_ANY,
+ .usage = "",
.help = "shut the server down",
},
COMMAND_REGISTRATION_DONE
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;
}