- /*
- * Receive notification when connection dies.
- */
- if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon, sizeof(turnon)) < 0) {
- Emsg1(M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n") , strerror(errno));
+ /*
+ * Receive notification when connection dies.
+ */
+ if (setsockopt(newsockfd, SOL_SOCKET, SO_KEEPALIVE, (sockopt_val_t)&turnon,
+ sizeof(turnon)) < 0) {
+ berrno be;
+ Emsg1(M_WARNING, 0, _("Cannot set SO_KEEPALIVE on socket: %s\n"),
+ be.strerror());
+ }
+
+ /* see who client is. i.e. who connected to us. */
+ P(mutex);
+ sockaddr_to_ascii(&cli_addr, buf, sizeof(buf));
+ V(mutex);
+ BSOCK *bs;
+ bs = init_bsock(NULL, newsockfd, "client", buf, fd_ptr->port, &cli_addr);
+ if (bs == NULL) {
+ Jmsg0(NULL, M_ABORT, 0, _("Could not create client BSOCK.\n"));
+ }
+
+ /* Queue client to be served */
+ if ((stat = workq_add(client_wq, (void *)bs, NULL, 0)) != 0) {
+ berrno be;
+ be.set_errno(stat);
+ Jmsg1(NULL, M_ABORT, 0, _("Could not add job to client queue: ERR=%s\n"),
+ be.strerror());
+ }
+ }