Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't include code for PONG #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rohitpaulk
Copy link
Member

@rohitpaulk rohitpaulk commented Feb 8, 2023

Thanks to @camin-mccluskey for pointing this out!

@github-actions
Copy link

github-actions bot commented Feb 8, 2023

Stage 1: init (clojure)

solutions/clojure/01-init/diff/src/redis/core.clj.diff

old content
@@ -9,30 +9,27 @@
   [socket]
   (.readLine (io/reader socket)))

 (defn send-message
   "Send the given string message out over the given socket"
   [socket msg]
   (let [writer (io/writer socket)]
     (.write writer msg)
     (.flush writer)))

 (defn serve [port handler]
   (with-open [server-sock (ServerSocket. port)
               sock (.accept server-sock)]
     (. server-sock (setReuseAddress true))
     (let [msg-in (receive-message sock)
           msg-out (handler msg-in)]
       (send-message sock msg-out))))

 (defn handler
   [& args]
   "+PONG\r\n")

 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
-  ;; You can use print statements as follows for debugging, they'll be visible when running tests.
-  (println "Logs from your program will appear here!")
-  ;; Uncomment this block to pass the first stage
-  ;; (serve 6379 handler)
+  (serve 6379 handler)
   )
new content
@@ -9,30 +9,27 @@
   [socket]
   (.readLine (io/reader socket)))

 (defn send-message
   "Send the given string message out over the given socket"
   [socket msg]
   (let [writer (io/writer socket)]
     (.write writer msg)
     (.flush writer)))

 (defn serve [port handler]
   (with-open [server-sock (ServerSocket. port)
               sock (.accept server-sock)]
     (. server-sock (setReuseAddress true))
     (let [msg-in (receive-message sock)
           msg-out (handler msg-in)]
       (send-message sock msg-out))))

 (defn handler
   [& args]
   "TODO: <respond-with-output>")

 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
-  ;; You can use print statements as follows for debugging, they'll be visible when running tests.
-  (println "Logs from your program will appear here!")
-  ;; Uncomment this block to pass the first stage
-  ;; (serve 6379 handler)
+  (serve 6379 handler)
   )

Posted via course-sdk.

@rohitpaulk rohitpaulk closed this Feb 11, 2023
@rohitpaulk rohitpaulk reopened this Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant